summaryrefslogtreecommitdiff
path: root/src/system/vrrp-script-wrapper.py
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@vyos.io>2020-03-23 04:19:44 +0700
committerGitHub <noreply@github.com>2020-03-23 04:19:44 +0700
commit0ae1e074e6a6f6cf6133b6f00127739ad39b2a4d (patch)
treeadf5293108fb36a981fbe30bb7387be0a61f4448 /src/system/vrrp-script-wrapper.py
parente93c92f9e6b2ee29e671a4c1d2750500cc5f63b7 (diff)
parent79ef46e8af11c6fc57f9465b1b9ac97e775f2c89 (diff)
downloadvyos-1x-0ae1e074e6a6f6cf6133b6f00127739ad39b2a4d.tar.gz
vyos-1x-0ae1e074e6a6f6cf6133b6f00127739ad39b2a4d.zip
Merge pull request #255 from DmitriyEshenko/crux-vrrp
vrrp: T1884: Add mode-force for run transition-scripts without checkiā€¦
Diffstat (limited to 'src/system/vrrp-script-wrapper.py')
-rwxr-xr-xsrc/system/vrrp-script-wrapper.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/system/vrrp-script-wrapper.py b/src/system/vrrp-script-wrapper.py
index ccd640128..fff7ee154 100755
--- a/src/system/vrrp-script-wrapper.py
+++ b/src/system/vrrp-script-wrapper.py
@@ -30,6 +30,7 @@ parser = argparse.ArgumentParser()
parser.add_argument("-t", "--state", type=str, help="VRRP state")
parser.add_argument("-g", "--group", type=str, help="VRRP group")
parser.add_argument("-i", "--interface", type=str, help="Network interface")
+parser.add_argument("-f", "--force", type=str, help="enable|disable force mode")
parser.add_argument("script", nargs='+')
syslog.openlog('vyos-vrrp-wrapper')
@@ -48,12 +49,13 @@ args.script = " ".join(args.script)
# in command line options to avoid executing scripts if no real transition occured.
# This is necessary because keepalived does not keep persistent state data even between
# config reloads and will cheerfully execute everything whether it's required or not.
+if args.force != "enable":
+ old_state = vyos.keepalived.get_old_state(args.group)
+else:
+ old_state = None
-old_state = vyos.keepalived.get_old_state(args.group)
-
+exitcode = 0
if (old_state is None) or (old_state != args.state):
- exitcode = 0
-
# Run the script and save the new state
# Change the process GID to the config owners group to avoid screwing up