diff options
author | Christian Poessinger <christian@poessinger.com> | 2020-03-20 18:43:47 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-20 18:43:47 +0100 |
commit | 22e0fb4c259afc22a0b9c4270f15a05729bc51f0 (patch) | |
tree | 8c7ca39d924565b2a39c41b54e2d7eb435f048d3 /python/vyos/ifconfig/interface.py | |
parent | f5a5befd7625b5acb9122236a3e14722581d6527 (diff) | |
parent | d50102307526555cfbf84a9b1e78eebe9e098141 (diff) | |
download | vyos-1x-22e0fb4c259afc22a0b9c4270f15a05729bc51f0.tar.gz vyos-1x-22e0fb4c259afc22a0b9c4270f15a05729bc51f0.zip |
Merge pull request #251 from thomas-mangin/T2057-required
ifconfig: T2057: skip required check if we do not create the interface
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 bb6c33f5f..21ffa88f6 100644 --- a/python/vyos/ifconfig/interface.py +++ b/python/vyos/ifconfig/interface.py @@ -170,13 +170,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 |