From d822de344c8425b793e0595ba1d0a70c033d2cc3 Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Sun, 12 Aug 2018 15:57:00 +0200 Subject: T772: fixup for keepalived not understanding escaped quotes. Since it does not understand escaped quotes inside notify_* options, until we fix that, we have to put the script and its arguments in positional arguments and join inside the transition script runner. --- src/system/vrrp-script-wrapper.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/system') diff --git a/src/system/vrrp-script-wrapper.py b/src/system/vrrp-script-wrapper.py index ce9142b7d..ccd640128 100755 --- a/src/system/vrrp-script-wrapper.py +++ b/src/system/vrrp-script-wrapper.py @@ -27,10 +27,10 @@ import vyos.keepalived parser = argparse.ArgumentParser() -parser.add_argument("-s", "--script", type=str, help="Script to run") 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("script", nargs='+') syslog.openlog('vyos-vrrp-wrapper') @@ -40,6 +40,10 @@ if not args.script or not args.state or not args.group \ parser.print_usage() sys.exit(1) +# Fixup: the reason we take multiple "script" arguments is that people may want +# to pass arguments to the script +args.script = " ".join(args.script) + # Get the old state if it exists and compare it to the current state received # 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 -- cgit v1.2.3