@@ -2039,7 +2039,7 @@ def query(self, ops, all_itf=False, format_list=False, allow_classes=None,
20392039 if not iface_read_ret or not ret :
20402040 raise Exception ()
20412041
2042- def _reload_currentlyup (self , upops , downops , auto = False , allow = None ,
2042+ def _reload_currentlyup (self , upops , downops , all_itf = False , allow_classes = None ,
20432043 ifacenames = None , excludepats = None , usecurrentconfig = False ,
20442044 syntaxcheck = False , ** extra_args ):
20452045 """ reload currently up interfaces """
@@ -2054,16 +2054,23 @@ def _reload_currentlyup(self, upops, downops, auto=False, allow=None,
20542054 if not self .ifaceobjdict :
20552055 self .logger .warning ("nothing to reload ..exiting." )
20562056 return
2057- already_up_ifacenames = []
2058- if not ifacenames : ifacenames = list (self .ifaceobjdict .keys ())
20592057
2058+ # Get a filtered list of interfaces to work on
2059+ filtered_ifacenames = self ._get_filtered_ifacenames_with_classes (
2060+ all_itf , allow_classes , excludepats , ifacenames )
2061+
2062+ if not filtered_ifacenames :
2063+ self .logger .warning ("nothing to reload ..exiting." )
2064+ return
2065+
2066+ already_up_ifacenames = []
20602067 if (not usecurrentconfig and self .flags .STATEMANAGER_ENABLE
20612068 and self .statemanager .ifaceobjdict ):
20622069 already_up_ifacenames = list (self .statemanager .ifaceobjdict .keys ())
20632070
20642071 # Get already up interfaces that still exist in the interfaces file
20652072 already_up_ifacenames_not_present = set (
2066- already_up_ifacenames ).difference (ifacenames )
2073+ already_up_ifacenames ).difference (filtered_ifacenames )
20672074 already_up_ifacenames_still_present = set (
20682075 already_up_ifacenames ).difference (
20692076 already_up_ifacenames_not_present )
@@ -2099,10 +2106,8 @@ def _reload_currentlyup(self, upops, downops, auto=False, allow=None,
20992106
21002107 # reinitialize dependency graph
21012108 self .dependency_graph = OrderedDict ({})
2102- falready_up_ifacenames_not_present = [i for i in
2103- already_up_ifacenames_not_present
2104- if self ._iface_whitelisted (auto , allow ,
2105- excludepats , i )]
2109+ falready_up_ifacenames_not_present = self ._get_filtered_ifacenames_with_classes (
2110+ False , allow_classes , excludepats , already_up_ifacenames_not_present )
21062111 self .populate_dependency_info (downops ,
21072112 falready_up_ifacenames_not_present )
21082113 self ._sched_ifaces (falready_up_ifacenames_not_present , downops ,
@@ -2112,7 +2117,7 @@ def _reload_currentlyup(self, upops, downops, auto=False, allow=None,
21122117
21132118 # Now, run 'up' with new config dict
21142119 # reset statemanager update flag to default
2115- if auto :
2120+ if all_itf :
21162121 ifupdownflags .flags .ALL = True
21172122 ifupdownflags .flags .WITH_DEPENDS = True
21182123 if new_ifaceobjdict :
@@ -2135,7 +2140,7 @@ def _reload_currentlyup(self, upops, downops, auto=False, allow=None,
21352140 if not iface_read_ret or not ret :
21362141 raise Exception ()
21372142
2138- def _reload_default (self , upops , downops , auto = False , allow = None ,
2143+ def _reload_default (self , upops , downops , all_itf = False , allow_classes = None ,
21392144 ifacenames = None , excludepats = None , usecurrentconfig = False ,
21402145 syntaxcheck = False , ** extra_args ):
21412146 """ reload interface config """
@@ -2151,9 +2156,15 @@ def _reload_default(self, upops, downops, auto=False, allow=None,
21512156 return
21522157
21532158 if not ifacenames : ifacenames = list (self .ifaceobjdict .keys ())
2154- new_filtered_ifacenames = [i for i in ifacenames
2155- if self ._iface_whitelisted (auto , allow ,
2156- excludepats , i )]
2159+
2160+ # Get a filtered list of interfaces to work on
2161+ new_filtered_ifacenames = self ._get_filtered_ifacenames_with_classes (
2162+ all_itf , allow_classes , excludepats , ifacenames )
2163+
2164+ if not new_filtered_ifacenames :
2165+ self .logger .warning ("nothing to reload ..exiting." )
2166+ return
2167+
21572168 # generate dependency graph of interfaces
21582169 self .populate_dependency_info (upops )
21592170
@@ -2194,9 +2205,8 @@ def _reload_default(self, upops, downops, auto=False, allow=None,
21942205
21952206 if op == 'reload' and ifacenames :
21962207 ifacenames = list (self .ifaceobjdict .keys ())
2197- old_filtered_ifacenames = [i for i in ifacenames
2198- if self ._iface_whitelisted (auto , allow ,
2199- excludepats , i )]
2208+ old_filtered_ifacenames = self ._get_filtered_ifacenames_with_classes (
2209+ all_itf , allow_classes , excludepats , ifacenames )
22002210
22012211 # generate dependency graph of old interfaces,
22022212 # This should make sure built in interfaces are
@@ -2365,7 +2375,7 @@ def _reload_default(self, upops, downops, auto=False, allow=None,
23652375 self .logger .debug ('no interfaces to up' )
23662376 return
23672377
2368- if auto :
2378+ if all_itf :
23692379 ifupdownflags .flags .ALL = True
23702380 ifupdownflags .flags .WITH_DEPENDS = True
23712381 # and now, we are back to the current config in ifaceobjdict
0 commit comments