FIXUP: Use exceptions to ease the flow

This commit is contained in:
Alexis Métaireau 2025-02-26 16:22:30 +01:00
parent f136687b41
commit 0f2e67298f
No known key found for this signature in database
GPG key ID: C65C7A89A8FFC56E

View file

@ -29,8 +29,7 @@ def upgrade(image: str, pubkey: str) -> None:
"""Upgrade the image to the latest signed version.""" """Upgrade the image to the latest signed version."""
manifest_digest = registry.get_manifest_digest(image) manifest_digest = registry.get_manifest_digest(image)
try: try:
is_upgraded = signatures.upgrade_container_image(image, manifest_digest, pubkey) signatures.upgrade_container_image(image, manifest_digest, pubkey)
if is_upgraded:
click.echo(f"✅ The local image {image} has been upgraded") click.echo(f"✅ The local image {image} has been upgraded")
click.echo(f"✅ The image has been signed with {pubkey}") click.echo(f"✅ The image has been signed with {pubkey}")
click.echo(f"✅ Signatures has been verified and stored locally") click.echo(f"✅ Signatures has been verified and stored locally")