From 305ae07537c6d409cbf254adf56152078e5ddb27 Mon Sep 17 00:00:00 2001 From: Tim Waugh Date: Wed, 11 Sep 2024 11:16:17 +0100 Subject: [PATCH] Fix create_sbom parameters --- sbom/examples/container_image/release/from_catalog.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sbom/examples/container_image/release/from_catalog.py b/sbom/examples/container_image/release/from_catalog.py index 83ee4a1..1f81f67 100644 --- a/sbom/examples/container_image/release/from_catalog.py +++ b/sbom/examples/container_image/release/from_catalog.py @@ -36,8 +36,8 @@ def get_rpms(image_id): return sorted(response.json()["rpms"], key=lambda rpm: rpm["nvra"]) -def create_sbom(image_id, root_package, packages, rel_type, other_pkgs=[], other_rels=[]): - relationships = list(other_rels) +def create_sbom(image_id, root_package, packages, rel_type, other_pkgs=None, other_rels=None): + relationships = list(other_rels or []) relationships.insert( 0, { @@ -72,7 +72,7 @@ def create_sbom(image_id, root_package, packages, rel_type, other_pkgs=[], other }, "name": image_id, "documentNamespace": f"https://www.redhat.com/{image_id}.spdx.json", - "packages": [root_package] + packages + other_pkgs, + "packages": [root_package] + packages + (other_pkgs or []), "relationships": relationships, }