1
0
mirror of https://github.com/CumulusNetworks/ifupdown2.git synced 2024-05-06 15:54:50 +00:00

ifupdownmain: ifquery check read_iface_config errors

auto swp1
iface swp1
      typo_attribute 42

$ ifquery -ac
error: /etc/network/interfaces: line9: iface swp1: unsupported keyword (typo_attribute)
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp                                                [pass]

auto swp1
iface swp1

$ echo $?
1
$
$ echo $?
1
$ ifup -a
error: /etc/network/interfaces: line9: iface swp1: unsupported keyword (typo_attribute)
$ echo $?
1
$

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
This commit is contained in:
Julien Fortin
2019-07-12 22:46:56 +04:00
parent 5e8a4802f1
commit 89f5bbe52c

View File

@ -1800,6 +1800,9 @@ class ifupdownMain(ifupdownBase):
if self.flags.STATEMANAGER_ENABLE and ops[0] == 'query-savedstate':
return self.statemanager.dump_pretty(ifacenames)
self.flags.STATEMANAGER_UPDATE = False
iface_read_ret = True
if auto:
self.logger.debug('setting flag ALL')
ifupdownflags.flags.ALL = True
@ -1814,7 +1817,7 @@ class ifupdownMain(ifupdownBase):
ifacePrivFlags(False, True)), ifacenames)
else:
try:
self.read_iface_config()
iface_read_ret = self.read_iface_config()
except Exception:
raise
@ -1865,14 +1868,16 @@ class ifupdownMain(ifupdownBase):
if ops[0] == 'query' and ifupdownflags.flags.WITHDEFAULTS:
return self.print_ifaceobjs_pretty(filtered_ifacenames, format)
elif ops[0] == 'query-checkcurr':
ret = self.print_ifaceobjscurr_pretty(filtered_ifacenames, format)
if ret != 0:
if self.print_ifaceobjscurr_pretty(filtered_ifacenames, format):
# if any of the object has an error, signal that silently
raise Exception('')
elif ops[0] == 'query-running':
self.print_ifaceobjsrunning_pretty(filtered_ifacenames, format)
return
if not iface_read_ret or not ret:
raise Exception()
def _reload_currentlyup(self, upops, downops, auto=False, allow=None,
ifacenames=None, excludepats=None, usecurrentconfig=False,
syntaxcheck=False, **extra_args):