diff options
author | DmitriyEshenko <dmitriy.eshenko@vyos.io> | 2020-02-07 21:45:53 +0000 |
---|---|---|
committer | DmitriyEshenko <dmitriy.eshenko@vyos.io> | 2020-02-07 21:45:53 +0000 |
commit | 79ef46e8af11c6fc57f9465b1b9ac97e775f2c89 (patch) | |
tree | a1dab16b2ccda50666dea89c6511439767b0922f /src/conf_mode/vrrp.py | |
parent | ebfd8e5e6ef64f86291b28ad08225fb497c32655 (diff) | |
download | vyos-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/conf_mode/vrrp.py')
-rwxr-xr-x | src/conf_mode/vrrp.py | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/conf_mode/vrrp.py b/src/conf_mode/vrrp.py index 04bce9d39..79ecf0c95 100755 --- a/src/conf_mode/vrrp.py +++ b/src/conf_mode/vrrp.py @@ -35,6 +35,11 @@ config_tmpl = """ # Do not edit this file, all your changes will be lost # on next commit or reboot +global_defs { + dynamic_interfaces + script_user root +} + {% for group in groups -%} {% if group.health_check_script -%} @@ -103,15 +108,19 @@ vrrp_instance {{ group.name }} { {% endif -%} {% if group.master_script -%} - notify_master "/usr/libexec/vyos/system/vrrp-script-wrapper.py --state master --group {{ group.name }} --interface {{ group.interface }} {{ group.master_script }}" + notify_master "/usr/libexec/vyos/system/vrrp-script-wrapper.py --state master --group {{ group.name }} --interface {{ group.interface }} --force {{ group.mode_force }} {{ group.master_script }}" {% endif -%} {% if group.backup_script -%} - notify_backup "/usr/libexec/vyos/system/vrrp-script-wrapper.py --state backup --group {{ group.name }} --interface {{ group.interface }} {{ group.backup_script }}" + notify_backup "/usr/libexec/vyos/system/vrrp-script-wrapper.py --state backup --group {{ group.name }} --interface {{ group.interface }} --force {{ group.mode_force }} {{ group.backup_script }}" {% endif -%} {% if group.fault_script -%} - notify_fault "/usr/libexec/vyos/system/vrrp-script-wrapper.py --state fault --group {{ group.name }} --interface {{ group.interface }} {{ group.fault_script }}" + notify_fault "/usr/libexec/vyos/system/vrrp-script-wrapper.py --state fault --group {{ group.name }} --interface {{ group.interface }} --force {{ group.mode_force }} {{ group.fault_script }}" + {% endif -%} + + {% if group.stop_script -%} + notify_stop "/usr/libexec/vyos/system/vrrp-script-wrapper.py --state stop --group {{ group.name }} --interface {{ group.interface }} --force {{ group.mode_force }} {{ group.stop_script }}" {% endif -%} } @@ -155,7 +164,7 @@ def get_config(): config.set_level("high-availability vrrp group {0}".format(group_name)) # Retrieve the values - group = {"preempt": True, "use_vmac": False, "disable": False} + group = {"preempt": True, "use_vmac": False, "disable": False, "mode_force": "disable"} if config.exists("disable"): group["disable"] = True @@ -182,6 +191,10 @@ def get_config(): group["master_script"] = config.return_value("transition-script master") group["backup_script"] = config.return_value("transition-script backup") group["fault_script"] = config.return_value("transition-script fault") + group["stop_script"] = config.return_value("transition-script stop") + + if config.exists("transition-script mode-force"): + group["mode_force"] = "enable" if config.exists("no-preempt"): group["preempt"] = False |