summaryrefslogtreecommitdiff
path: root/src/system
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/system
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/system')
-rwxr-xr-xsrc/system/keepalived-fifo.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/system/keepalived-fifo.py b/src/system/keepalived-fifo.py
index 3b4330e9b..159fd0f54 100755
--- a/src/system/keepalived-fifo.py
+++ b/src/system/keepalived-fifo.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
#
-# Copyright (C) 2020 VyOS maintainers and contributors
+# Copyright (C) 2020-2021 VyOS maintainers and contributors
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 or later as
@@ -13,7 +13,6 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
import os
import time
@@ -22,11 +21,12 @@ import argparse
import threading
import re
import json
-from pathlib import Path
-from queue import Queue
import logging
+
+from queue import Queue
from logging.handlers import SysLogHandler
+from vyos.ifconfig.vrrp import VRRP
from vyos.util import cmd
# configure logging
@@ -62,7 +62,7 @@ class KeepalivedFifo:
def _config_load(self):
try:
# read the dictionary file with configuration
- with open('/run/keepalived_config.dict', 'r') as dict_file:
+ with open(VRRP.location['vyos'], 'r') as dict_file:
vrrp_config_dict = json.load(dict_file)
self.vrrp_config = {'vrrp_groups': {}, 'sync_groups': {}}
# save VRRP instances to the new dictionary
@@ -95,8 +95,8 @@ class KeepalivedFifo:
# create FIFO pipe
def pipe_create(self):
- if Path(self.pipe_path).exists():
- logger.info("PIPE already exist: {}".format(self.pipe_path))
+ if os.path.exists(self.pipe_path):
+ logger.info(f"PIPE already exist: {self.pipe_path}")
else:
os.mkfifo(self.pipe_path)
@@ -135,7 +135,7 @@ class KeepalivedFifo:
if n_type == 'GROUP':
if os.path.exists(mdns_running_file):
cmd(mdns_update_command)
-
+
if n_name in self.vrrp_config['sync_groups'] and n_state in self.vrrp_config['sync_groups'][n_name]:
n_script = self.vrrp_config['sync_groups'][n_name].get(n_state)
if n_script: