diff options
author | Christian Poessinger <christian@poessinger.com> | 2020-06-27 12:56:18 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2020-06-27 13:51:28 +0200 |
commit | adfb4c81a41b9eec4b33a27a8d8db7184dbda6da (patch) | |
tree | bd5667fe957c4851eda08c266f248e19ef5addc1 /src | |
parent | e0bd74e399cc2693b6d442af52c9345e279db059 (diff) | |
download | vyos-1x-adfb4c81a41b9eec4b33a27a8d8db7184dbda6da.tar.gz vyos-1x-adfb4c81a41b9eec4b33a27a8d8db7184dbda6da.zip |
ifconfig: T2653: dummy: loopback: use same get_config() structure as MACsec
Diffstat (limited to 'src')
-rwxr-xr-x | src/conf_mode/interfaces-dummy.py | 12 | ||||
-rwxr-xr-x | src/conf_mode/interfaces-loopback.py | 10 |
2 files changed, 11 insertions, 11 deletions
diff --git a/src/conf_mode/interfaces-dummy.py b/src/conf_mode/interfaces-dummy.py index 676211428..a8093ffa5 100755 --- a/src/conf_mode/interfaces-dummy.py +++ b/src/conf_mode/interfaces-dummy.py @@ -41,6 +41,10 @@ def get_config(): base = ['interfaces', 'dummy', ifname] dummy = conf.get_config_dict(base, key_mangling=('-', '_')) + # Check if interface has been removed + if dummy == {}: + dummy.update({'deleted' : ''}) + # store interface instance name in dictionary dummy.update({'ifname': ifname}) @@ -50,14 +54,10 @@ def get_config(): tmp = {'is_bridge_member' : bridge} dummy.update(tmp) - # Check if interface has been removed - tmp = {'deleted' : not conf.exists(base)} - dummy.update(tmp) - return dummy def verify(dummy): - if dummy['deleted']: + if 'deleted' in dummy.keys(): verify_bridge_delete(dummy) return None @@ -73,7 +73,7 @@ def apply(dummy): d = DummyIf(dummy['ifname']) # Remove dummy interface - if dummy['deleted']: + if 'deleted' in dummy.keys(): d.remove() else: d.update(dummy) diff --git a/src/conf_mode/interfaces-loopback.py b/src/conf_mode/interfaces-loopback.py index 32e683c07..7c3d8663d 100755 --- a/src/conf_mode/interfaces-loopback.py +++ b/src/conf_mode/interfaces-loopback.py @@ -36,13 +36,13 @@ def get_config(): base = ['interfaces', 'loopback', ifname] loopback = conf.get_config_dict(base, key_mangling=('-', '_')) + # Check if interface has been removed + if loopback == {}: + loopback.update({'deleted' : ''}) + # store interface instance name in dictionary loopback.update({'ifname': ifname}) - # Check if interface has been removed - tmp = {'deleted' : not conf.exists(base)} - loopback.update(tmp) - return loopback def verify(loopback): @@ -53,7 +53,7 @@ def generate(loopback): def apply(loopback): l = LoopbackIf(loopback['ifname']) - if loopback['deleted']: + if 'deleted' in loopback.keys(): l.remove() else: l.update(loopback) |