Skip to content

Commit a24429d

Browse files
committed
full structured log complete
1 parent 391b030 commit a24429d

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

examples/client/multi-image/manage_project_structure.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ class MultiImageProjectManager():
6868

6969
def __init__(self, args):
7070
self.debug = args.debug
71+
self.binary = args.binary
7172
self.log_config()
7273
self.base_url = args.base_url
7374
with open(args.token_file, 'r') as tf:
@@ -412,7 +413,7 @@ def scan_container_images(self):
412413
parent_version,
413414
detect_options,
414415
hub=hub,
415-
binary=False
416+
binary=self.binary
416417
)
417418
child['scan_results'] = results
418419
except Exception:
@@ -449,14 +450,21 @@ def parse_command_args():
449450
parser.add_argument("-str", "--string-to-put-in-front-of-subproject-name", required=False, help="Prefix string for subproject names" )
450451
parser.add_argument("-d", "--debug", action='store_true', help="Set debug output on")
451452
parser.add_argument("--strict", action='store_true', help="Fail if existing (sub)project versions already exist")
453+
parser.add_argument("--binary", action='store_true', help="Use binary scan for analysis")
452454
return parser.parse_args()
453455

454456
def main():
457+
from datetime import datetime
458+
timestamp = datetime.now().strftime("%Y-%m-%d_%H%M%S")
455459
args = parse_command_args()
456460
mipm = MultiImageProjectManager(args)
457461
logging.info(f"Parsed {len(mipm.project_data['subprojects'])} projects from specification data")
458462
mipm.proceed()
459-
463+
filename_complete = f"{args.project_name}-{args.version_name}-{timestamp}-full.json"
464+
filename_failures = f"{args.project_name}-{args.version_name}-{timestamp}-failures.json"
465+
# write full processing log
466+
with open (filename_complete, "w") as f:
467+
json.dump(mipm.project_data, f, indent=2)
460468

461469
if __name__ == "__main__":
462470
sys.exit(main())

0 commit comments

Comments
 (0)