Skip to content

Commit 62b82cf

Browse files
committed
full structured log complete
1 parent a24429d commit 62b82cf

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

examples/client/multi-image/manage_project_structure.py

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -416,9 +416,10 @@ def scan_container_images(self):
416416
binary=self.binary
417417
)
418418
child['scan_results'] = results
419-
except Exception:
420-
import traceback
421-
traceback.print_exc()
419+
except Exception as e:
420+
# import traceback
421+
# traceback.print_exc()
422+
self.log('error', repr(e), child)
422423
logging.error(f"Scanning of {image_name} failed, skipping")
423424

424425
def proceed(self):
@@ -466,5 +467,22 @@ def main():
466467
with open (filename_complete, "w") as f:
467468
json.dump(mipm.project_data, f, indent=2)
468469

470+
failures = list()
471+
for sname, sub in mipm.project_data['subprojects'].items():
472+
structure = False
473+
runtime = False
474+
if sub['status'] != 'PRESENT':
475+
structure = True
476+
if not sub.get('scan_results', None):
477+
runtime = True
478+
else:
479+
rcodes = [r['scan_results']['returncode'] for r in sub['scan_results'] if r.get('scan_results', None)]
480+
if sum(rcodes) > 0:
481+
runtime = True
482+
if structure or runtime:
483+
failures.append(sub)
484+
with open (filename_failures, "w") as f:
485+
json.dump(failures, f, indent=2)
486+
469487
if __name__ == "__main__":
470488
sys.exit(main())

0 commit comments

Comments
 (0)