summaryrefslogtreecommitdiff
path: root/src/conf_mode
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-09-21 20:29:36 +0200
committerChristian Poessinger <christian@poessinger.com>2021-09-21 20:32:57 +0200
commitb243795eba1b36cadd81c3149e833bdf5c5bea70 (patch)
treed8e8c016d5bd43216402c04fbaa8e2dbf0e8dbe3 /src/conf_mode
parentddda0d66faa73900ed2b8fec1dde38ffc4a49fcd (diff)
downloadvyos-1x-b243795eba1b36cadd81c3149e833bdf5c5bea70.tar.gz
vyos-1x-b243795eba1b36cadd81c3149e833bdf5c5bea70.zip
vrrp: keepalived: T616: move configuration to volatile /run directory
Move keepalived configuration from /etc/keepalived to /run/keepalived.
Diffstat (limited to 'src/conf_mode')
-rwxr-xr-xsrc/conf_mode/vrrp.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/conf_mode/vrrp.py b/src/conf_mode/vrrp.py
index 2ece792dc..f11dce879 100755
--- a/src/conf_mode/vrrp.py
+++ b/src/conf_mode/vrrp.py
@@ -30,6 +30,7 @@ import vyos.config
from vyos import ConfigError
from vyos.util import call
+from vyos.util import makedir
from vyos.template import render
from vyos.ifconfig.vrrp import VRRP
@@ -136,7 +137,9 @@ def get_config(config=None):
sync_groups.append(sync_group)
# create a file with dict with proposed configuration
- with open("{}.temp".format(VRRP.location['vyos']), 'w') as dict_file:
+ dirname = os.path.dirname(VRRP.location['vyos'])
+ makedir(dirname)
+ with open(VRRP.location['vyos'] + ".temp", 'w') as dict_file:
dict_file.write(dumps({'vrrp_groups': vrrp_groups, 'sync_groups': sync_groups}))
return (vrrp_groups, sync_groups)