summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorThomas Mangin <thomas.mangin@exa.net.uk>2020-03-20 13:59:33 +0000
committerThomas Mangin <thomas.mangin@exa.net.uk>2020-03-20 14:36:52 +0000
commitd50102307526555cfbf84a9b1e78eebe9e098141 (patch)
tree626b56a4d7e8fff5381cda0d1b6b021a2ed48a17 /python
parentaca6154bfd25cf62dbbce21d6a3bf56024f62035 (diff)
downloadvyos-1x-d50102307526555cfbf84a9b1e78eebe9e098141.tar.gz
vyos-1x-d50102307526555cfbf84a9b1e78eebe9e098141.zip
ifconfig: T2057: skip required fields check if we do not create the interface
Diffstat (limited to 'python')
-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 b002e0171..9dc798eb8 100644
--- a/python/vyos/ifconfig/interface.py
+++ b/python/vyos/ifconfig/interface.py
@@ -166,13 +166,15 @@ class Interface(Control):
if k in kargs:
self.config[k] = kargs[k]
- for k in self.required:
- if k not in kargs:
- raise ConfigError('missing required option {} for {}'.format(k,self.__class__))
-
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']))
+
+ for k in self.required:
+ if k not in kargs:
+ name = self.default['type']
+ raise ConfigError(f'missing required option {k} for {name} {ifname} creation')
+
self._create()
# per interface DHCP config files