From 3da860eea6d5b471f70be7235207a0ce1f0a95d3 Mon Sep 17 00:00:00 2001 From: Gabriel Adrian Samfira Date: Sat, 16 Jul 2022 13:47:17 +0000 Subject: [PATCH] Always lookup images in simplestreams This change makes sure we always download the latest image from simplestreams. We no longer copy labels from simplestreams so we need to lookup the hash of the image against simplestreams. This means that in airgapped environments, the operator will have to manually tag images and use the tag name in favor of remote:image_name. Signed-off-by: Gabriel Adrian Samfira --- runner/providers/lxd/images.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/runner/providers/lxd/images.go b/runner/providers/lxd/images.go index 259d8d4e..3a66e163 100644 --- a/runner/providers/lxd/images.go +++ b/runner/providers/lxd/images.go @@ -113,8 +113,6 @@ func (i *image) copyImageFromRemote(remote config.LXDImageRemote, imageName stri return nil, errors.Wrap(err, "waiting for image copy operation") } - // We should now have the image locally. Force another query. This probably makes no sense, - // but this is done only once. return image, nil } @@ -134,13 +132,14 @@ func (i *image) EnsureImage(imageName string, imageType config.LXDImageType, arc return nil, errors.Wrap(err, "parsing image name") } - if img, err := i.getLocalImageByAlias(parsedName, imageType, arch, cli); err == nil { + if img, err := i.copyImageFromRemote(remote, parsedName, imageType, arch, cli); err == nil { return img, nil } else { - log.Printf("failed to fetch local image of type %v with name %s and arch %s: %s", imageType, parsedName, arch, err) + log.Printf("failed to fetch image of type %v with name %s and arch %s: %s", imageType, parsedName, arch, err) } - img, err := i.copyImageFromRemote(remote, parsedName, imageType, arch, cli) + log.Printf("attempting to find %s for arch %s locally", parsedName, arch) + img, err := i.getLocalImageByAlias(parsedName, imageType, arch, cli) if err != nil { return nil, errors.Wrap(err, "fetching image") }