summaryrefslogtreecommitdiff
path: root/src/conf_mode/vrrp.py
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:18:54 +0000
commit65398e5c8aedf2f206bb706e97aa828e409d07b3 (patch)
tree648ce98ae0d30b3576bbd289d2a35230e5441c45 /src/conf_mode/vrrp.py
parent259e0458ff89b88493f98a5730c4fc91ff9da10f (diff)
downloadvyos-1x-65398e5c8aedf2f206bb706e97aa828e409d07b3.tar.gz
vyos-1x-65398e5c8aedf2f206bb706e97aa828e409d07b3.zip
vrrp: keepalived: T616: move configuration to volatile /run directory
Move keepalived configuration from /etc/keepalived to /run/keepalived. (cherry picked from commit b243795eba1b36cadd81c3149e833bdf5c5bea70)
Diffstat (limited to 'src/conf_mode/vrrp.py')
-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 4cee87003..cee6a9ba2 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)