Skip to content

Commit

Permalink
Merge pull request #569 from jajreidy/fix-clouds-json-parse
Browse files Browse the repository at this point in the history
Fixes parsing of clouds.json file.
  • Loading branch information
rohanpm authored Aug 20, 2024
2 parents 18f8c60 + 4c17cd3 commit 795bcf5
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/pushsource/_impl/model/ami.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ def _from_data(cls, data):
kwargs = {
# base push item fields
"name": data["name"],
"build": data.get("build") or None,
"state": "PENDING",
"src": data.get("src") or None,
"dest": data.get("dest") or [],
Expand All @@ -241,7 +242,7 @@ def _from_data(cls, data):
if data.get("billing_codes")
else None
),
"image_id": data.get("ami") or None,
"image_id": data.get("ami") or data.get("image_id") or None,
"public_image": data.get("public_image"),
"release_notes": data.get("release_notes") or None,
"usage_instructions": data.get("usage_instructions") or None,
Expand Down
33 changes: 33 additions & 0 deletions tests/pub/test_pub_amis.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
AmiRelease,
Source,
AmiSecurityGroup,
KojiBuildInfo,
)

DATAPATH = os.path.join(os.path.dirname(__file__), "data")
Expand Down Expand Up @@ -131,6 +132,14 @@ def test_get_ami_push_items_single_task_clouds(requests_mock):
state="PENDING",
src="/test/path/packages/rhel-sap-ec2/8.8/2116/images/rhel-sap-ec2-8.8-2116.x86_64.raw.xz",
dest=["test-dest"],
image_id="ami-test",
build="rhel-sap-ec2-8.8-2116",
build_info=KojiBuildInfo(
name="rhel-sap-ec2",
version="8.8",
release="2116",
id=None,
),
release=AmiRelease(
product="RHEL-SAP",
date="20240717",
Expand Down Expand Up @@ -194,6 +203,14 @@ def test_get_ami_push_items_rhcos_task_cloud(requests_mock):
state="PENDING",
src="/test/path/packages/rhel-sap-ec2/8.8/2116/images/rhel-sap-ec2-8.8-2116.x86_64.raw.xz",
dest=["test-dest"],
image_id="ami-test",
build="rhel-sap-ec2-8.8-2116",
build_info=KojiBuildInfo(
name="rhel-sap-ec2",
version="8.8",
release="2116",
id=None,
),
release=AmiRelease(
product="RHEL-SAP",
date="20240717",
Expand Down Expand Up @@ -224,6 +241,14 @@ def test_get_ami_push_items_rhcos_task_cloud(requests_mock):
state="PENDING",
src="/test/path/packages/rhel-sap-ec2/8.8/2116/images/rhel-sap-ec2-8.8-2116.x86_64.raw.xz",
dest=["test-dest2"],
build="rhel-sap-ec2-8.8-2116",
build_info=KojiBuildInfo(
name="rhel-sap-ec2",
version="8.8",
release="2116",
id=None,
),
image_id="ami-test",
release=AmiRelease(
product="RHEL-SAP",
date="20240717",
Expand Down Expand Up @@ -254,6 +279,14 @@ def test_get_ami_push_items_rhcos_task_cloud(requests_mock):
state="PENDING",
src="/test/path/packages/rhel-ec2/8.8/2175/images/rhel-ec2-8.8-2175.x86_64.raw.xz",
dest=["testb"],
build="rhel-ec2-8.8-2175",
build_info=KojiBuildInfo(
name="rhel-ec2",
version="8.8",
release="2175",
id=None,
),
image_id="ami-test",
release=AmiRelease(
product="RHEL",
date="20240717",
Expand Down

0 comments on commit 795bcf5

Please sign in to comment.