summaryrefslogtreecommitdiff
path: root/python/vyos/validate.py
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-07-24 17:20:50 +0200
committerChristian Poessinger <christian@poessinger.com>2020-07-25 17:30:12 +0200
commitf81b0443cf09c34cb1f2060094e3eb294b8fa192 (patch)
treeda5c3b85a8fc3cd113ceae3a2f2a8b8c770954e9 /python/vyos/validate.py
parentadd7eaebe7b8ebd4e143eb939d3ba7871ead0502 (diff)
downloadvyos-1x-f81b0443cf09c34cb1f2060094e3eb294b8fa192.tar.gz
vyos-1x-f81b0443cf09c34cb1f2060094e3eb294b8fa192.zip
bonding: ifconfig: T2653: move to get_config_dict()
The current VyOS CLI parser code written in Python contains a ton of duplicates which I can also hold myself accountable for - or maybe mainly me - depends on the angle of judge.
Diffstat (limited to 'python/vyos/validate.py')
-rw-r--r--python/vyos/validate.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/python/vyos/validate.py b/python/vyos/validate.py
index a0620e4dd..ceeb6888a 100644
--- a/python/vyos/validate.py
+++ b/python/vyos/validate.py
@@ -279,7 +279,6 @@ def is_member(conf, interface, intftype=None):
False -> interface type cannot have members
"""
ret_val = None
-
if intftype not in ['bonding', 'bridge', None]:
raise ValueError((
f'unknown interface type "{intftype}" or it cannot '
@@ -292,9 +291,9 @@ def is_member(conf, interface, intftype=None):
conf.set_level([])
for it in intftype:
- base = 'interfaces ' + it
+ base = ['interfaces', it]
for intf in conf.list_nodes(base):
- memberintf = [base, intf, 'member', 'interface']
+ memberintf = base + [intf, 'member', 'interface']
if xml.is_tag(memberintf):
if interface in conf.list_nodes(memberintf):
ret_val = intf