diff options
author | Christian Poessinger <christian@poessinger.com> | 2022-08-04 08:57:07 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-04 08:57:07 +0200 |
commit | 241fad230beed8889719e08f0fdb9f08d1404e0f (patch) | |
tree | b6da869fe4e3800c9745b6bcdb26cfec481af21c /src/conf_mode/interfaces-bridge.py | |
parent | 394ebb01d21713f4154e72cee4aaea674da19359 (diff) | |
parent | f6dddb5466c95e998582f7ec774b2626b9a9067c (diff) | |
download | vyos-1x-241fad230beed8889719e08f0fdb9f08d1404e0f.tar.gz vyos-1x-241fad230beed8889719e08f0fdb9f08d1404e0f.zip |
Merge pull request #1450 from c-po/bridge-fixes-equuleus
bridge: bugfixes for equuleus
Diffstat (limited to 'src/conf_mode/interfaces-bridge.py')
-rwxr-xr-x | src/conf_mode/interfaces-bridge.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/conf_mode/interfaces-bridge.py b/src/conf_mode/interfaces-bridge.py index 9ad39e080..f548a0e75 100755 --- a/src/conf_mode/interfaces-bridge.py +++ b/src/conf_mode/interfaces-bridge.py @@ -60,7 +60,7 @@ def get_config(config=None): else: bridge.update({'member': {'interface_remove': tmp }}) - if dict_search('member.interface', bridge): + if dict_search('member.interface', bridge) != None: # XXX: T2665: we need a copy of the dict keys for iteration, else we will get: # RuntimeError: dictionary changed size during iteration for interface in list(bridge['member']['interface']): @@ -102,6 +102,14 @@ def get_config(config=None): if 'enable_vlan' in bridge and tmp: bridge['member']['interface'][interface].update({'has_vlan' : ''}) + # delete empty dictionary keys - no need to run code paths if nothing is there to do + if 'member' in bridge: + if 'interface' in bridge['member'] and len(bridge['member']['interface']) == 0: + del bridge['member']['interface'] + + if len(bridge['member']) == 0: + del bridge['member'] + return bridge def verify(bridge): |