Skip to content

Commit 90f984b

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 3b62cb4 commit 90f984b

File tree

2 files changed

+52
-38
lines changed

2 files changed

+52
-38
lines changed

src/pushsource/_impl/backend/koji_source.py

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ def _push_items_from_vmi_build(self, nvr, meta):
520520
message = "Virtual machine image build not found in koji: %s" % nvr
521521
LOG.debug(message)
522522
raise ValueError(message)
523-
523+
524524
# VMI has the {'typeinfo': {'image':{}}} on extra
525525
extra = meta.get("extra") or {}
526526
typeinfo = extra.get("typeinfo") or {}
@@ -537,7 +537,7 @@ def _push_items_from_vmi_build(self, nvr, meta):
537537
message = "Build %s not recognized as a virtual machine image build" % nvr
538538
LOG.debug(message)
539539
raise ValueError(message)
540-
540+
541541
build_id = meta["id"]
542542
archives = self._get_archives(build_id)
543543
for archive in archives:
@@ -554,7 +554,7 @@ def _push_items_from_vmi_build(self, nvr, meta):
554554

555555
for k in azure_types:
556556
cloud_types.setdefault(k, VHDPushItem)
557-
557+
558558
# Collect all known VM image archives
559559
vmi_archives = [
560560
elem
@@ -621,7 +621,7 @@ def _push_items_from_vmi_build(self, nvr, meta):
621621
)
622622

623623
return out
624-
624+
625625
def _push_items_from_rhcos_build(self, nvr, meta, archives=None):
626626

627627
LOG.debug("Looking for core os assembler build on %s, %s", nvr, meta)
@@ -642,7 +642,9 @@ def _push_items_from_rhcos_build(self, nvr, meta, archives=None):
642642
arch = image.get("arch")
643643
boot_mode = image.get("boot_mode")
644644

645-
version = rhcos_meta_data["coreos-assembler.container-config-git"]["branch"].split("-")[-1]
645+
version = rhcos_meta_data["coreos-assembler.container-config-git"][
646+
"branch"
647+
].split("-")[-1]
646648

647649
if boot_mode is not None:
648650
boot_mode = BootMode(boot_mode)
@@ -661,9 +663,7 @@ def _push_items_from_rhcos_build(self, nvr, meta, archives=None):
661663
"custom_meta_data": {
662664
"region": ami.get("name"),
663665
"src": ami.get("hvm"),
664-
665-
}
666-
666+
},
667667
}
668668
)
669669

@@ -674,9 +674,7 @@ def _push_items_from_rhcos_build(self, nvr, meta, archives=None):
674674
"push_item_class": VHDPushItem,
675675
"custom_meta_data": {
676676
"src": rhcos_meta_data["azure"]["url"],
677-
678-
}
679-
677+
},
680678
}
681679
)
682680

@@ -708,7 +706,7 @@ def _push_items_from_rhcos_build(self, nvr, meta, archives=None):
708706
version=version,
709707
release=meta["release"],
710708
),
711-
sha256sum = sha256sum,
709+
sha256sum=sha256sum,
712710
release=release,
713711
)
714712
)

tests/koji/test_koji_vmi.py

Lines changed: 42 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -240,35 +240,36 @@ def test_koji_vmi_compound_product_name(fake_koji, koji_dir):
240240
release=rel_obj,
241241
)
242242

243+
243244
@mark.parametrize("boot_mode", [None, "legacy", "uefi", "hybrid"])
244-
def test_coreos_assembler_image(boot_mode,fake_koji, koji_dir):
245+
def test_coreos_assembler_image(boot_mode, fake_koji, koji_dir):
245246
boot_mode_enum = BootMode(boot_mode) if boot_mode else None
246247

247248
archives = []
248249
images = {
249250
"meta.json": "json",
250251
"commitmeta.json": "json",
251-
"coreos-assembler-git.tar.gz": "tar"
252-
252+
"coreos-assembler-git.tar.gz": "tar",
253253
}
254254
for file_name, type_name in images.items():
255255
archives.append(
256-
{'btype': 'image',
257-
'btype_id': 4,
258-
'build_id': 123456,
259-
'buildroot_id': 1234567,
260-
'checksum': 'dde60621880aa996c42e356a687744ef',
261-
'checksum_type': 0,
262-
'compression_type': None,
263-
'filename': file_name,
264-
'id': 234792,
265-
'metadata_only': False,
266-
'size': 16077,
267-
'type_description': 'JSON data',
268-
'type_extensions': 'json',
269-
'type_id': 49,
270-
'type_name': type_name
271-
}
256+
{
257+
"btype": "image",
258+
"btype_id": 4,
259+
"build_id": 123456,
260+
"buildroot_id": 1234567,
261+
"checksum": "dde60621880aa996c42e356a687744ef",
262+
"checksum_type": 0,
263+
"compression_type": None,
264+
"filename": file_name,
265+
"id": 234792,
266+
"metadata_only": False,
267+
"size": 16077,
268+
"type_description": "JSON data",
269+
"type_extensions": "json",
270+
"type_id": 49,
271+
"type_name": type_name,
272+
}
272273
)
273274

274275
name = "rhcos"
@@ -288,7 +289,8 @@ def test_coreos_assembler_image(boot_mode,fake_koji, koji_dir):
288289
"release": release,
289290
"nvr": nvr,
290291
"completion_time": "2022-12-20 12:30:25",
291-
"extra": {"typeinfo": {"image": {"arch": "x86_64","boot_mode": boot_mode}}}}
292+
"extra": {"typeinfo": {"image": {"arch": "x86_64", "boot_mode": boot_mode}}},
293+
}
292294

293295
fake_koji.build_data[nvr] = fake_koji.build_data[1234]
294296

@@ -325,12 +327,26 @@ def test_coreos_assembler_image(boot_mode,fake_koji, koji_dir):
325327
items = list(source)
326328

327329
vms_with_custom_meta_data = [
328-
{'target': 'aws', 'push_item_class': AmiPushItem, 'custom_meta_data': {'region': 'us-gov-west-1',
329-
'src': 'ami-01'}, "sha256": "4ef7806152bd89ce44326ff746c4f1883ad543885e980bce59821df2d946ea4c"},
330-
{'target': 'aws', 'push_item_class': AmiPushItem, 'custom_meta_data': {'region': 'us-east-1',
331-
'src': 'ami-02'}, "sha256": "4ef7806152bd89ce44326ff746c4f1883ad543885e980bce59821df2d946ea4c"},
332-
{'target': 'azure', 'push_item_class': VHDPushItem, 'custom_meta_data': {
333-
'src': 'https://example.windows.net/imagebucket/rhcos-4.11-0-azure.x86_64.vhd'}, "sha256": "2cd817331af29093e2eaa025139ebddd6008c193970b06b35afbbdbebae0ce3e"}
330+
{
331+
"target": "aws",
332+
"push_item_class": AmiPushItem,
333+
"custom_meta_data": {"region": "us-gov-west-1", "src": "ami-01"},
334+
"sha256": "4ef7806152bd89ce44326ff746c4f1883ad543885e980bce59821df2d946ea4c",
335+
},
336+
{
337+
"target": "aws",
338+
"push_item_class": AmiPushItem,
339+
"custom_meta_data": {"region": "us-east-1", "src": "ami-02"},
340+
"sha256": "4ef7806152bd89ce44326ff746c4f1883ad543885e980bce59821df2d946ea4c",
341+
},
342+
{
343+
"target": "azure",
344+
"push_item_class": VHDPushItem,
345+
"custom_meta_data": {
346+
"src": "https://example.windows.net/imagebucket/rhcos-4.11-0-azure.x86_64.vhd"
347+
},
348+
"sha256": "2cd817331af29093e2eaa025139ebddd6008c193970b06b35afbbdbebae0ce3e",
349+
},
334350
]
335351

336352
out = []

0 commit comments

Comments
 (0)