summaryrefslogtreecommitdiff
path: root/python/vyos/ifconfig/interface.py
diff options
context:
space:
mode:
authorThomas Mangin <thomas.mangin@exa.net.uk>2020-03-31 16:59:33 +0100
committerThomas Mangin <thomas.mangin@exa.net.uk>2020-03-31 16:59:55 +0100
commit05e79a4bb2137ee3ea563ced7f64b033c41eb438 (patch)
tree4569cd88efc01a1473e90dfd90b271ac54e9f711 /python/vyos/ifconfig/interface.py
parent458ccfc2f0fe46d399d2412af60d8ade26b57f65 (diff)
downloadvyos-1x-05e79a4bb2137ee3ea563ced7f64b033c41eb438.tar.gz
vyos-1x-05e79a4bb2137ee3ea563ced7f64b033c41eb438.zip
ifconfig: T2057: allow to disable interface debugging
In order to be able to use the interface class with operational mode, these commands must not log as it would otherwise mess with the output on the screen.
Diffstat (limited to 'python/vyos/ifconfig/interface.py')
-rw-r--r--python/vyos/ifconfig/interface.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/python/vyos/ifconfig/interface.py b/python/vyos/ifconfig/interface.py
index 8b41d6158..4a34f96d6 100644
--- a/python/vyos/ifconfig/interface.py
+++ b/python/vyos/ifconfig/interface.py
@@ -162,15 +162,17 @@ class Interface(DHCP):
>>> i = Interface('eth0')
"""
- DHCP.__init__(self, ifname)
-
self.config = deepcopy(self.default)
- self.config['ifname'] = ifname
-
for k in self.options:
if k in kargs:
self.config[k] = kargs[k]
+ # make sure the ifname is the first argument and not from the dict
+ self.config['ifname'] = ifname
+
+ # we must have updated config before initialising the Interface
+ super().__init__(ifname, **kargs)
+
if not os.path.exists('/sys/class/net/{}'.format(self.config['ifname'])):
if not self.config['type']:
raise Exception('interface "{}" not found'.format(self.config['ifname']))