Skip to content

Commit 647443d

Browse files
author
Olivier BLIN
committed
Implement new interfaces selection for ifup
* The 'no ifaces found matching' exception has been replaced by a quiet early return
1 parent dc716bf commit 647443d

File tree

1 file changed

+6
-18
lines changed

1 file changed

+6
-18
lines changed

ifupdown2/ifupdown/ifupdownmain.py

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1767,7 +1767,7 @@ def _preprocess_excludepats(self, excludepats):
17671767
self.logger.info('excludepats after processing companions [%s]' %' '.join(new_excludepats))
17681768
return new_excludepats
17691769

1770-
def up(self, ops, auto=False, allow_classes=None, ifacenames=None,
1770+
def up(self, ops, all_itf=False, allow_classes=None, ifacenames=None,
17711771
excludepats=None, printdependency=None, syntaxcheck=False,
17721772
type=None, skipupperifaces=False):
17731773
"""This brings the interface(s) up
@@ -1790,7 +1790,7 @@ def up(self, ops, auto=False, allow_classes=None, ifacenames=None,
17901790
ifupdownflags.flags.CLASS = True
17911791
if not self.flags.ADDONS_ENABLE:
17921792
self.flags.STATEMANAGER_UPDATE = False
1793-
if auto:
1793+
if all_itf:
17941794
ifupdownflags.flags.ALL = True
17951795
ifupdownflags.flags.WITH_DEPENDS = True
17961796
try:
@@ -1801,24 +1801,12 @@ def up(self, ops, auto=False, allow_classes=None, ifacenames=None,
18011801
if excludepats:
18021802
excludepats = self._preprocess_excludepats(excludepats)
18031803

1804-
filtered_ifacenames = None
1805-
if ifacenames:
1806-
ifacenames = self._preprocess_ifacenames(ifacenames)
1807-
1808-
if allow_classes:
1809-
filtered_ifacenames = self._get_filtered_ifacenames_with_classes(auto, allow_classes, excludepats, ifacenames)
1810-
1811-
# if iface list not given by user, assume all from config file
1812-
if not ifacenames: ifacenames = list(self.ifaceobjdict.keys())
1813-
1814-
if not filtered_ifacenames:
1815-
# filter interfaces based on auto and allow classes
1816-
filtered_ifacenames = [i for i in ifacenames
1817-
if self._iface_whitelisted(auto, allow_classes,
1818-
excludepats, i)]
1804+
# Get a filtered list of interfaces to work on
1805+
filtered_ifacenames = self._get_filtered_ifacenames_with_classes(
1806+
all_itf, allow_classes, excludepats, ifacenames)
18191807

18201808
if not filtered_ifacenames:
1821-
raise Exception('no ifaces found matching given allow lists')
1809+
return
18221810

18231811
if printdependency:
18241812
self.populate_dependency_info(ops, filtered_ifacenames)

0 commit comments

Comments
 (0)