LXC: Fix lxc image list
regression
#14563
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #14561 introduced with #14260.
This PR fixes a regression introduced with #14260 by adding
GetImagesAllProjects
andGetImagesAllProjectsWithFilter
functions toclient/simplestreams_images.go
, and moving their method signatures tothe
ImageServer
interface. While adding support for fetching images across all projects, we changed the logic in thelxc 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 asimages
andubuntu-minimal-daily
.The actual bug comes from the following LOC:
lxd/lxc/image.go
Lines 1356 to 1359 in 4a3c4a3
Fetching from an instance server isn't applicable for
simplestreams
servers, soGetImagesAllProjects
is never reached due to the error raised byc.global.conf.GetInstanceServer
. Instead, we should fetch an image server before fetching images, hence why moving the new client functions method signatures to theImageServer
interface fixes the regression.