diff options
author | Christian Poessinger <christian@poessinger.com> | 2020-07-25 00:39:14 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2020-07-25 17:30:12 +0200 |
commit | e70a304e36fc6456e16fea81ace4a0a5fd8bd1df (patch) | |
tree | 3959df9b7a5509b84ea92fd1fb577a8e0038d004 /src/conf_mode/interfaces-bridge.py | |
parent | 72c0ac35b4acf049de29ce1ea67af28659793098 (diff) | |
download | vyos-1x-e70a304e36fc6456e16fea81ace4a0a5fd8bd1df.tar.gz vyos-1x-e70a304e36fc6456e16fea81ace4a0a5fd8bd1df.zip |
ifconfig: T2653: make ifname an optional argument to get_interface_dict()
Further reduce the boiler-plate code to determine interface tag node or not.
It can be passed into get_interface_dict() if explicitly required - else it
is taken from the environment.
Diffstat (limited to 'src/conf_mode/interfaces-bridge.py')
-rwxr-xr-x | src/conf_mode/interfaces-bridge.py | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/src/conf_mode/interfaces-bridge.py b/src/conf_mode/interfaces-bridge.py index 9c43d1983..ee8e85e73 100755 --- a/src/conf_mode/interfaces-bridge.py +++ b/src/conf_mode/interfaces-bridge.py @@ -41,13 +41,7 @@ def get_config(): """ conf = Config() base = ['interfaces', 'bridge'] - - # determine tagNode instance - if 'VYOS_TAGNODE_VALUE' not in os.environ: - raise ConfigError('Interface (VYOS_TAGNODE_VALUE) not specified') - - ifname = os.environ['VYOS_TAGNODE_VALUE'] - bridge = get_interface_dict(conf, base, ifname) + bridge = get_interface_dict(conf, base) # determine which members have been removed tmp = node_changed(conf, ['member', 'interface']) @@ -69,13 +63,12 @@ def get_config(): # the default dictionary is not properly paged into the dict (see T2665) # thus we will ammend it ourself default_member_values = defaults(base + ['member', 'interface']) - for interface, interface_config in bridge['member']['interface'].items(): interface_config.update(default_member_values) # Check if we are a member of another bridge device tmp = is_member(conf, interface, 'bridge') - if tmp and tmp != ifname: + if tmp and tmp != bridge['ifname']: interface_config.update({'is_bridge_member' : tmp}) # Check if we are a member of a bond device |