Skip to content

Conversation

@kadinsayani
Copy link
Member

@kadinsayani kadinsayani commented Nov 29, 2024

Fixes #14561 introduced with #14260.

This PR fixes a regression introduced with #14260 by adding GetImagesAllProjects and
GetImagesAllProjectsWithFilter functions to client/simplestreams_images.go, and moving their method signatures to
the ImageServer interface. While adding support for fetching images across all projects, we changed the logic in the lxc image list command to call different functions based on whether the --all-projects flag is passed in or not:

1fae6e6

This is fine, but we needed to add simplestreams protocol support as well to facilitate listing public images from remotes such as images and ubuntu-minimal-daily.

The actual bug comes from the following LOC:

lxd/lxc/image.go

Lines 1356 to 1359 in 4a3c4a3

d, err := c.global.conf.GetInstanceServer(remoteName)
if err != nil {
return err
}

Fetching from an instance server isn't applicable for simplestreams servers, so GetImagesAllProjects is never reached due to the error raised by c.global.conf.GetInstanceServer. Instead, we should fetch an image server before fetching images, hence why moving the new client functions method signatures to the ImageServer interface fixes the regression.

@kadinsayani kadinsayani changed the title LXC: Add GetImagesAllProjects and GetImagesAllProjectsWithFilter LXC: Fix lxc image list regression Nov 29, 2024
…lter` client functions and interfaces to `simplestreams_images.go`

This commit fixes a regression introduced with support for fetching
images across all projects by adding `GetImagesAllProjects` and
`GetImagesAllProjectsWithFilter` functions to
`client/simplestreams_images.go`, and moving their method signatures to
the `ImageServer` interface.

Signed-off-by: Kadin Sayani <[email protected]>
Copy link
Member

@tomponline tomponline left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for quick fix

@tomponline tomponline merged commit 631058f into canonical:main Nov 30, 2024
@kadinsayani kadinsayani deleted the 14561-image-list-fix branch November 30, 2024 16:47
tomponline added a commit that referenced this pull request Jan 24, 2025
#14563 attempted to fix
#14561 by adding
`GetImagesAllProjects` and `GetImagesAllProjectsWithFilter` functions to
`client/simplestreams_images.go`, and moving their method signatures to
the `ImageServer` interface. Instead, we should only expand the
`InstanceServer` interface and correctly use the client functions when
`--all-projects` is set.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[regression]: lxc image list <OFFICIAL REMOTE>: broken on latest/edge

2 participants