summaryrefslogtreecommitdiff
path: root/src/conf_mode
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2024-04-04 13:56:23 +0200
committerGitHub <noreply@github.com>2024-04-04 13:56:23 +0200
commitd729069c58c0a670e1f57d6d12c57a41e330742b (patch)
tree71d6a531dfa6b60e89ea478fd871775514edeb29 /src/conf_mode
parentdf2f99f2db19194ece81141c85e6bbb27cbe24ca (diff)
parentc6e80f7ab8a241f75fab25f14d64ccb6750d6efe (diff)
downloadvyos-1x-d729069c58c0a670e1f57d6d12c57a41e330742b.tar.gz
vyos-1x-d729069c58c0a670e1f57d6d12c57a41e330742b.zip
Merge pull request #3239 from nicolas-fort/T6068-sag
T6068: T6171: change <fail-over> node to <high-availability>; add <mode> parameter
Diffstat (limited to 'src/conf_mode')
-rwxr-xr-xsrc/conf_mode/service_dhcp-server.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/conf_mode/service_dhcp-server.py b/src/conf_mode/service_dhcp-server.py
index e910ecdf7..3cfd74a19 100755
--- a/src/conf_mode/service_dhcp-server.py
+++ b/src/conf_mode/service_dhcp-server.py
@@ -131,6 +131,10 @@ def get_config(config=None):
dhcp['shared_network_name'][network]['subnet'][subnet].update(
{'range' : new_range_dict})
+ if len(dhcp['high_availability']) == 1:
+ ## only default value for mode is set, need to remove ha node
+ del dhcp['high_availability']
+
return dhcp
def verify(dhcp):
@@ -178,9 +182,9 @@ def verify(dhcp):
# DHCP failover needs at least one subnet that uses it
if 'enable_failover' in subnet_config:
- if 'failover' not in dhcp:
- raise ConfigError(f'Can not enable failover for "{subnet}" in "{network}".\n' \
- 'Failover is not configured globally!')
+ if 'high_availability' not in dhcp:
+ raise ConfigError(f'Can not enable high availability for "{subnet}" in "{network}".\n' \
+ 'High availability is not configured globally!')
failover_ok = True
# Check if DHCP address range is inside configured subnet declaration
@@ -270,12 +274,12 @@ def verify(dhcp):
if (shared_networks - disabled_shared_networks) < 1:
raise ConfigError(f'At least one shared network must be active!')
- if 'failover' in dhcp:
+ if 'high_availability' in dhcp:
if not failover_ok:
raise ConfigError('DHCP failover must be enabled for at least one subnet!')
for key in ['name', 'remote', 'source_address', 'status']:
- if key not in dhcp['failover']:
+ if key not in dhcp['high_availability']:
tmp = key.replace('_', '-')
raise ConfigError(f'DHCP failover requires "{tmp}" to be specified!')