summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-09-22 08:18:42 +0200
committerChristian Poessinger <christian@poessinger.com>2021-09-22 08:18:42 +0200
commit3114c7ccbdf867f9cdaa436792937b16ea4d85bf (patch)
tree59493140110880acf9cd70d35b8b70e12a0677b6
parentb9d4d8c67d6b41ebbf5b570c7c6b09e05520e737 (diff)
downloadvyos-1x-3114c7ccbdf867f9cdaa436792937b16ea4d85bf.tar.gz
vyos-1x-3114c7ccbdf867f9cdaa436792937b16ea4d85bf.zip
vrrp: keepalived: T3847: enable no_tag_node_value_mangle for get_config_dict()
Commit 761631d6 ("vrrp: keepalived: T3847: migrate to get_config_dict()") switched to the new python function get_config_dict(), when we deal with tag nodes that can contain a hyphen, we should also set no_tag_node_value_mangle in order to preserve it. This caused a dict lookup error as the hyphens in the test scripts got replaced by an _.
-rw-r--r--data/templates/vrrp/keepalived.conf.tmpl4
-rwxr-xr-xsrc/conf_mode/vrrp.py3
2 files changed, 5 insertions, 2 deletions
diff --git a/data/templates/vrrp/keepalived.conf.tmpl b/data/templates/vrrp/keepalived.conf.tmpl
index e31bfaac0..b4824a994 100644
--- a/data/templates/vrrp/keepalived.conf.tmpl
+++ b/data/templates/vrrp/keepalived.conf.tmpl
@@ -23,7 +23,9 @@ vrrp_script healthcheck_{{ name }} {
}
{% endif %}
vrrp_instance {{ name }} {
- {{ '# ' ~ group_config.description if group_config.description is defined }}
+{% if group_config.description is defined and group_config.description is not none %}
+ # {{ group_config.description }}
+{% endif %}
state BACKUP
interface {{ group_config.interface }}
virtual_router_id {{ group_config.vrid }}
diff --git a/src/conf_mode/vrrp.py b/src/conf_mode/vrrp.py
index ffe9dd276..e8f1c1f99 100755
--- a/src/conf_mode/vrrp.py
+++ b/src/conf_mode/vrrp.py
@@ -43,7 +43,8 @@ def get_config(config=None):
if not conf.exists(base):
return None
- vrrp = conf.get_config_dict(base, key_mangling=('-', '_'), get_first_key=True)
+ vrrp = conf.get_config_dict(base, key_mangling=('-', '_'),
+ get_first_key=True, no_tag_node_value_mangle=True)
# We have gathered the dict representation of the CLI, but there are default
# options which we need to update into the dictionary retrived.
if 'group' in vrrp: