Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LXC: Fix lxc image list regression #14563

Merged
merged 1 commit into from
Nov 30, 2024

Conversation

kadinsayani
Copy link
Contributor

@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
27 checks passed
@kadinsayani kadinsayani deleted the 14561-image-list-fix branch November 30, 2024 16:47
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