diff options
author | Christian Poessinger <christian@poessinger.com> | 2020-03-31 18:01:20 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-31 18:01:20 +0200 |
commit | 685de4c3f9d3367a25ff1320cdacaf6427f6cc80 (patch) | |
tree | 176941850c632e37b9853ee842b41188caae7cd7 /python/vyos/ifconfig/interface.py | |
parent | c707202f440e387310f97a75b737f482c11ef72e (diff) | |
parent | 10f31524db1623bf115f88c3a432b5c37522d2e4 (diff) | |
download | vyos-1x-685de4c3f9d3367a25ff1320cdacaf6427f6cc80.tar.gz vyos-1x-685de4c3f9d3367a25ff1320cdacaf6427f6cc80.zip |
Merge pull request #283 from thomas-mangin/T2057-wg-dump
ifconfig: T2057: Move code from interface.py to wireguard.py
Diffstat (limited to 'python/vyos/ifconfig/interface.py')
-rw-r--r-- | python/vyos/ifconfig/interface.py | 10 |
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'])) |