summaryrefslogtreecommitdiff
path: root/src/system/vrrp-script-wrapper.py
diff options
context:
space:
mode:
authorDmitriyEshenko <dmitriy.eshenko@vyos.io>2020-02-07 21:45:53 +0000
committerDmitriyEshenko <dmitriy.eshenko@vyos.io>2020-02-07 21:45:53 +0000
commit79ef46e8af11c6fc57f9465b1b9ac97e775f2c89 (patch)
treea1dab16b2ccda50666dea89c6511439767b0922f /src/system/vrrp-script-wrapper.py
parentebfd8e5e6ef64f86291b28ad08225fb497c32655 (diff)
downloadvyos-1x-79ef46e8af11c6fc57f9465b1b9ac97e775f2c89.tar.gz
vyos-1x-79ef46e8af11c6fc57f9465b1b9ac97e775f2c89.zip
vrrp: T1884: Add mode-force for run transition-scripts without checking previous state
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