From 8afa06ee89a81487daecfd550cc2070ae5e3f0d2 Mon Sep 17 00:00:00 2001 From: Nalin Dahyabhai Date: Fri, 5 Apr 2024 13:31:25 -0400 Subject: [PATCH] Use a defined constant instead of a hard-coded magic value Use specV1.AnnotationTitle instead of hard-coding its value when we go looking for podman-machine images. Signed-off-by: Nalin Dahyabhai --- pkg/machine/ocipull/source.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/machine/ocipull/source.go b/pkg/machine/ocipull/source.go index 91eb67fbc4..a3d7125335 100644 --- a/pkg/machine/ocipull/source.go +++ b/pkg/machine/ocipull/source.go @@ -107,9 +107,9 @@ func GetDiskArtifactReference(ctx context.Context, imgSrc types.ImageSource, opt // podman-machine-images should have a original file name // stored in the annotations under org.opencontainers.image.title // i.e. fedora-coreos-39.20240128.2.2-qemu.x86_64.qcow2.xz - originalFileName, ok := v1MannyFest.Layers[0].Annotations["org.opencontainers.image.title"] + originalFileName, ok := v1MannyFest.Layers[0].Annotations[specV1.AnnotationTitle] if !ok { - return "", fmt.Errorf("unable to determine original artifact name: missing required annotation 'org.opencontainers.image.title'") + return "", fmt.Errorf("unable to determine original artifact name: missing required annotation '%s'", specV1.AnnotationTitle) } logrus.Debugf("original artifact file name: %s", originalFileName) return artifactDigest, err