@@ -354,38 +354,27 @@ def _preorder_depth_first_walk(self, target_filepath) -> Dict:
354354 child_roles = role_metadata .delegations .roles
355355
356356 if target is None :
357-
358357 child_roles_to_visit = []
359358 # NOTE: This may be a slow operation if there are many
360359 # delegated roles.
361360 for child_role in child_roles :
362361 if child_role .is_in_trusted_paths (target_filepath ):
363- child_role_name = child_role .name
364- else :
365- child_role_name = None
366362
367- if child_role .terminating and child_role_name is not None :
368- msg = (
369- f"Adding child role { child_role_name } .\n " ,
370- "Not backtracking to other roles." ,
371- )
363+ msg = f"Adding child role { child_role .name } "
372364 logger .debug (msg )
373- role_names = []
365+
374366 child_roles_to_visit .append (
375- (child_role_name , role_name )
367+ (child_role . name , role_name )
376368 )
377- break
378369
379- if child_role_name is None :
380- msg = f"Skipping child role { child_role_name } "
381- logger .debug (msg )
370+ if child_role .terminating :
371+ logger .debug ("Not backtracking to other roles." )
372+ role_names = []
373+ break
382374
383375 else :
384- msg = f"Adding child role { child_role_name } "
376+ msg = f"Skipping child role { child_role . name } "
385377 logger .debug (msg )
386- child_roles_to_visit .append (
387- (child_role_name , role_name )
388- )
389378
390379 # Push 'child_roles_to_visit' in reverse order of appearance
391380 # onto 'role_names'. Roles are popped from the end of
0 commit comments