summaryrefslogtreecommitdiff
path: root/src/conf_mode
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/conf_mode
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/conf_mode')
-rwxr-xr-xsrc/conf_mode/vrrp.py21
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