diff options
author | John Estabrook <jestabro@vyos.io> | 2023-08-06 15:25:13 -0500 |
---|---|---|
committer | John Estabrook <jestabro@vyos.io> | 2023-08-07 02:17:32 -0500 |
commit | ca76921fb2b90e82221d7280ffd8d0765319ffaa (patch) | |
tree | 698566fab5c9e7ee60e7a8a484d8e737bc20e7f4 /src/conf_mode | |
parent | a4d46e41abc958bc3b94aa545bb926e701b18f83 (diff) | |
download | vyos-1x-ca76921fb2b90e82221d7280ffd8d0765319ffaa.tar.gz vyos-1x-ca76921fb2b90e82221d7280ffd8d0765319ffaa.zip |
T5434: use merge_defaults in protocols_failover.py
Diffstat (limited to 'src/conf_mode')
-rwxr-xr-x | src/conf_mode/protocols_failover.py | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/src/conf_mode/protocols_failover.py b/src/conf_mode/protocols_failover.py index faf56d741..e7e44db84 100755 --- a/src/conf_mode/protocols_failover.py +++ b/src/conf_mode/protocols_failover.py @@ -19,10 +19,8 @@ import json from pathlib import Path from vyos.config import Config -from vyos.configdict import dict_merge from vyos.template import render from vyos.utils.process import call -from vyos.xml import defaults from vyos import ConfigError from vyos import airbag @@ -42,15 +40,12 @@ def get_config(config=None): conf = Config() base = ['protocols', 'failover'] - failover = conf.get_config_dict(base, key_mangling=('-', '_'), get_first_key=True) + failover = conf.get_config_dict(base, key_mangling=('-', '_'), + get_first_key=True) # Set default values only if we set config - if failover.get('route'): - for route, route_config in failover.get('route').items(): - for next_hop, next_hop_config in route_config.get('next_hop').items(): - default_values = defaults(base + ['route']) - failover['route'][route]['next_hop'][next_hop] = dict_merge( - default_values['next_hop'], failover['route'][route]['next_hop'][next_hop]) + if failover.get('route') is not None: + failover = conf.merge_defaults(failover, recursive=True) return failover |