@@ -2037,7 +2037,7 @@ def query(self, ops, all_itf=False, format_list=False, allow_classes=None,
20372037 if not iface_read_ret or not ret :
20382038 raise Exception ()
20392039
2040- def _reload_currentlyup (self , upops , downops , auto = False , allow = None ,
2040+ def _reload_currentlyup (self , upops , downops , all_itf = False , allow_classes = None ,
20412041 ifacenames = None , excludepats = None , usecurrentconfig = False ,
20422042 syntaxcheck = False , ** extra_args ):
20432043 """ reload currently up interfaces """
@@ -2052,16 +2052,23 @@ def _reload_currentlyup(self, upops, downops, auto=False, allow=None,
20522052 if not self .ifaceobjdict :
20532053 self .logger .warning ("nothing to reload ..exiting." )
20542054 return
2055- already_up_ifacenames = []
2056- if not ifacenames : ifacenames = list (self .ifaceobjdict .keys ())
20572055
2056+ # Get a filtered list of interfaces to work on
2057+ filtered_ifacenames = self ._get_filtered_ifacenames_with_classes (
2058+ all_itf , allow_classes , excludepats , ifacenames )
2059+
2060+ if not filtered_ifacenames :
2061+ self .logger .warning ("nothing to reload ..exiting." )
2062+ return
2063+
2064+ already_up_ifacenames = []
20582065 if (not usecurrentconfig and self .flags .STATEMANAGER_ENABLE
20592066 and self .statemanager .ifaceobjdict ):
20602067 already_up_ifacenames = list (self .statemanager .ifaceobjdict .keys ())
20612068
20622069 # Get already up interfaces that still exist in the interfaces file
20632070 already_up_ifacenames_not_present = set (
2064- already_up_ifacenames ).difference (ifacenames )
2071+ already_up_ifacenames ).difference (filtered_ifacenames )
20652072 already_up_ifacenames_still_present = set (
20662073 already_up_ifacenames ).difference (
20672074 already_up_ifacenames_not_present )
@@ -2097,10 +2104,8 @@ def _reload_currentlyup(self, upops, downops, auto=False, allow=None,
20972104
20982105 # reinitialize dependency graph
20992106 self .dependency_graph = OrderedDict ({})
2100- falready_up_ifacenames_not_present = [i for i in
2101- already_up_ifacenames_not_present
2102- if self ._iface_whitelisted (auto , allow ,
2103- excludepats , i )]
2107+ falready_up_ifacenames_not_present = self ._get_filtered_ifacenames_with_classes (
2108+ False , allow_classes , excludepats , already_up_ifacenames_not_present )
21042109 self .populate_dependency_info (downops ,
21052110 falready_up_ifacenames_not_present )
21062111 self ._sched_ifaces (falready_up_ifacenames_not_present , downops ,
@@ -2110,7 +2115,7 @@ def _reload_currentlyup(self, upops, downops, auto=False, allow=None,
21102115
21112116 # Now, run 'up' with new config dict
21122117 # reset statemanager update flag to default
2113- if auto :
2118+ if all_itf :
21142119 ifupdownflags .flags .ALL = True
21152120 ifupdownflags .flags .WITH_DEPENDS = True
21162121 if new_ifaceobjdict :
@@ -2133,7 +2138,7 @@ def _reload_currentlyup(self, upops, downops, auto=False, allow=None,
21332138 if not iface_read_ret or not ret :
21342139 raise Exception ()
21352140
2136- def _reload_default (self , upops , downops , auto = False , allow = None ,
2141+ def _reload_default (self , upops , downops , all_itf = False , allow_classes = None ,
21372142 ifacenames = None , excludepats = None , usecurrentconfig = False ,
21382143 syntaxcheck = False , ** extra_args ):
21392144 """ reload interface config """
@@ -2149,9 +2154,15 @@ def _reload_default(self, upops, downops, auto=False, allow=None,
21492154 return
21502155
21512156 if not ifacenames : ifacenames = list (self .ifaceobjdict .keys ())
2152- new_filtered_ifacenames = [i for i in ifacenames
2153- if self ._iface_whitelisted (auto , allow ,
2154- excludepats , i )]
2157+
2158+ # Get a filtered list of interfaces to work on
2159+ new_filtered_ifacenames = self ._get_filtered_ifacenames_with_classes (
2160+ all_itf , allow_classes , excludepats , ifacenames )
2161+
2162+ if not new_filtered_ifacenames :
2163+ self .logger .warning ("nothing to reload ..exiting." )
2164+ return
2165+
21552166 # generate dependency graph of interfaces
21562167 self .populate_dependency_info (upops )
21572168
@@ -2192,9 +2203,8 @@ def _reload_default(self, upops, downops, auto=False, allow=None,
21922203
21932204 if op == 'reload' and ifacenames :
21942205 ifacenames = list (self .ifaceobjdict .keys ())
2195- old_filtered_ifacenames = [i for i in ifacenames
2196- if self ._iface_whitelisted (auto , allow ,
2197- excludepats , i )]
2206+ old_filtered_ifacenames = self ._get_filtered_ifacenames_with_classes (
2207+ all_itf , allow_classes , excludepats , ifacenames )
21982208
21992209 # generate dependency graph of old interfaces,
22002210 # This should make sure built in interfaces are
@@ -2363,7 +2373,7 @@ def _reload_default(self, upops, downops, auto=False, allow=None,
23632373 self .logger .debug ('no interfaces to up' )
23642374 return
23652375
2366- if auto :
2376+ if all_itf :
23672377 ifupdownflags .flags .ALL = True
23682378 ifupdownflags .flags .WITH_DEPENDS = True
23692379 # and now, we are back to the current config in ifaceobjdict
0 commit comments