Skip to content

Commit c2c579e

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 5b60c3b commit c2c579e

File tree

1 file changed

+6
-18
lines changed

1 file changed

+6
-18
lines changed

ifupdown2/ifupdown/ifupdownmain.py

+6-18
Original file line numberDiff line numberDiff line change
@@ -1768,7 +1768,7 @@ def _preprocess_excludepats(self, excludepats):
17681768
self.logger.info('excludepats after processing companions [%s]' %' '.join(new_excludepats))
17691769
return new_excludepats
17701770

1771-
def up(self, ops, auto=False, allow_classes=None, ifacenames=None,
1771+
def up(self, ops, all_itf=False, allow_classes=None, ifacenames=None,
17721772
excludepats=None, printdependency=None, syntaxcheck=False,
17731773
type=None, skipupperifaces=False):
17741774
"""This brings the interface(s) up
@@ -1791,7 +1791,7 @@ def up(self, ops, auto=False, allow_classes=None, ifacenames=None,
17911791
ifupdownflags.flags.CLASS = True
17921792
if not self.flags.ADDONS_ENABLE:
17931793
self.flags.STATEMANAGER_UPDATE = False
1794-
if auto:
1794+
if all_itf:
17951795
ifupdownflags.flags.ALL = True
17961796
ifupdownflags.flags.WITH_DEPENDS = True
17971797
try:
@@ -1802,24 +1802,12 @@ def up(self, ops, auto=False, allow_classes=None, ifacenames=None,
18021802
if excludepats:
18031803
excludepats = self._preprocess_excludepats(excludepats)
18041804

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

18211809
if not filtered_ifacenames:
1822-
raise Exception('no ifaces found matching given allow lists')
1810+
return
18231811

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

0 commit comments

Comments
 (0)