From 05e79a4bb2137ee3ea563ced7f64b033c41eb438 Mon Sep 17 00:00:00 2001 From: Thomas Mangin Date: Tue, 31 Mar 2020 16:59:33 +0100 Subject: 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. --- python/vyos/ifconfig/interface.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'python/vyos/ifconfig/interface.py') 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'])) -- cgit v1.2.3