summaryrefslogtreecommitdiff
path: root/python/vyos/configdict.py
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-10-01 19:43:12 +0200
committerChristian Poessinger <christian@poessinger.com>2020-10-01 19:43:12 +0200
commit3508feea888bfc0d95eb8928d98afd50bc335eb9 (patch)
tree7f7482db335cfa633641a128432ae353b304a3b8 /python/vyos/configdict.py
parentabe6cb06d387bff8e145db1c9848b8b6c3612acb (diff)
downloadvyos-1x-3508feea888bfc0d95eb8928d98afd50bc335eb9.tar.gz
vyos-1x-3508feea888bfc0d95eb8928d98afd50bc335eb9.zip
configdict: T2372: use config.exists() when probing for interface removal
We must use exists() as get_config_dict() will always return {} - even when an empty interface node like +macsec macsec1 { +} exists.
Diffstat (limited to 'python/vyos/configdict.py')
-rw-r--r--python/vyos/configdict.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/python/vyos/configdict.py b/python/vyos/configdict.py
index 58ecd3f17..660d779d4 100644
--- a/python/vyos/configdict.py
+++ b/python/vyos/configdict.py
@@ -290,8 +290,12 @@ def get_interface_dict(config, base, ifname=''):
config.set_level(base + [ifname])
dict = config.get_config_dict([], key_mangling=('-', '_'), get_first_key=True)
- # Check if interface has been removed
- if dict == {}:
+ # Check if interface has been removed. We must use exists() as get_config_dict()
+ # will always return {} - even when an empty interface node like
+ # +macsec macsec1 {
+ # +}
+ # exists.
+ if not config.exists([]):
dict.update({'deleted' : ''})
# Add interface instance name into dictionary