@@ -291,6 +291,27 @@ def format_duration(seconds: float) -> str:
291291 return f"{ s } s"
292292
293293
294+ def format_unmapped_section (unmapped_items : Optional [List [dict ]]) -> str :
295+ """Format the UNMAPPED manual-action section for debug logging."""
296+ if not unmapped_items :
297+ return ''
298+ lines = [
299+ ' UNMAPPED — REQUIRES MANUAL ACTION' ,
300+ ' ' + '-' * 40 ,
301+ ]
302+ by_category = {} # type: Dict[str, List[dict]]
303+ for item in unmapped_items :
304+ cat = item .get ("category" , "Other" )
305+ by_category .setdefault (cat , []).append (item )
306+ for cat , items in sorted (by_category .items ()):
307+ lines .append (f' { cat } :' )
308+ for item in items :
309+ lines .append (f' { item .get ("item" , "" )} ' )
310+ lines .append (f' Action: { item .get ("action" , "" )} ' )
311+ lines .append ('' )
312+ return "\n " .join (lines )
313+
314+
294315def build_report (project_name : str , safes_processed : int , total_accounts : int ,
295316 resource_counts : Dict [str , Dict [str , int ]],
296317 platform_counts : Dict [str , Dict [str , Any ]],
@@ -402,20 +423,9 @@ def build_report(project_name: str, safes_processed: int, total_accounts: int,
402423 lines .append (f' Incomplete (missing fields): { incomplete_count } ' )
403424 lines .append ('' )
404425
405- # UNMAPPED section
426+ # UNMAPPED details are debug-only (see format_unmapped_section / logging.debug)
406427 if unmapped_items :
407- lines .append (' UNMAPPED — REQUIRES MANUAL ACTION' )
408- lines .append (' ' + '-' * 40 )
409- by_category = {} # type: Dict[str, List[dict]]
410- for item in unmapped_items :
411- cat = item .get ("category" , "Other" )
412- by_category .setdefault (cat , []).append (item )
413- for cat , items in sorted (by_category .items ()):
414- lines .append (f' { cat } :' )
415- for item in items :
416- lines .append (f' { item .get ("item" , "" )} ' )
417- lines .append (f' Action: { item .get ("action" , "" )} ' )
418- lines .append ('' )
428+ logging .debug ('\n %s' , format_unmapped_section (unmapped_items ))
419429
420430 # Gateway deployment
421431 gw_token = ''
@@ -435,9 +445,13 @@ def build_report(project_name: str, safes_processed: int, total_accounts: int,
435445 # Next steps
436446 lines .append (' NEXT STEPS' )
437447 lines .append (' ' + '-' * 40 )
438- lines .append (f' 1. Review UNMAPPED section — action each item' )
439- lines .append (f' 2. Verify: pam gateway list' )
440- lines .append (f' 3. Cleanup: pam project cyberark-cleanup --name "{ project_name } "' )
448+ step = 1
449+ if unmapped_items :
450+ lines .append (f' { step } . Review unmapped items in debug log (--debug)' )
451+ step += 1
452+ lines .append (f' { step } . Verify: pam gateway list' )
453+ step += 1
454+ lines .append (f' { step } . Cleanup: pam project cyberark-cleanup --name "{ project_name } "' )
441455 lines .append ('' )
442456
443457 # Command (redacted)
0 commit comments