From 07de3355e92f90fdcfd67721f4adbf6a8d6503d2 Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Thu, 11 May 2023 16:39:13 +0100 Subject: vyos.utils: T5195: fix option list output in vyos.utils.dict.check_mutually_exclusive_options on missing options error --- python/vyos/utils/dict.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/vyos/utils/dict.py b/python/vyos/utils/dict.py index 4afc9f54e..7c93deef6 100644 --- a/python/vyos/utils/dict.py +++ b/python/vyos/utils/dict.py @@ -253,4 +253,4 @@ def check_mutually_exclusive_options(d, keys, required=False): raise ValueError(f"Options {orig_keys} are mutually-exclusive but more than one of them is present: {orig_present_keys}") if required and (len(present_keys) < 1): - raise ValueError(f"At least one of the following options is required: {orig_present_keys}") + raise ValueError(f"At least one of the following options is required: {orig_keys}") -- cgit v1.2.3 From 00b48dfa0a1576242c5e67583375e8f4699be785 Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Thu, 11 May 2023 17:10:50 +0100 Subject: vrrp: T5215: fix VRRP commit error when health check is not configured --- src/conf_mode/high-availability.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/conf_mode/high-availability.py b/src/conf_mode/high-availability.py index 7a63f5b4b..e18b426b1 100755 --- a/src/conf_mode/high-availability.py +++ b/src/conf_mode/high-availability.py @@ -21,6 +21,7 @@ from ipaddress import ip_interface from ipaddress import IPv4Interface from ipaddress import IPv6Interface +from vyos.base import Warning from vyos.config import Config from vyos.configdict import dict_merge from vyos.ifconfig.vrrp import VRRP @@ -107,11 +108,16 @@ def verify(ha): raise ConfigError(f'Authentication requires both type and passwortd to be set in VRRP group "{group}"') if 'health_check' in group_config: + health_check_types = ["script", "ping"] from vyos.utils.dict import check_mutually_exclusive_options try: - check_mutually_exclusive_options(group_config["health_check"], ["script", "ping"], required=True) + check_mutually_exclusive_options(group_config["health_check"], health_check_types, required=True) except ValueError as e: - raise ConfigError(f'Health check config is incorrect in VRRP group "{group}": {e}') + Warning(f'Health check configuration for VRRP group "{group}" will remain unused ' \ + f'until it has one of the following options: {health_check_types}') + # XXX: health check has default options so we need to remove it + # to avoid generating useless config statements in keepalived.conf + del group_config["health_check"] # Keepalived doesn't allow mixing IPv4 and IPv6 in one group, so we mirror that restriction # We also need to make sure VRID is not used twice on the same interface with the -- cgit v1.2.3