Skip to content

Commit

Permalink
lxc/image: Only get instance server when --all-projects flag is set
Browse files Browse the repository at this point in the history
Signed-off-by: Kadin Sayani <kadin.sayani@canonical.com>
  • Loading branch information
kadinsayani committed Jan 21, 2025
1 parent a02b39f commit 2747305
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lxc/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -1353,11 +1353,6 @@ func (c *cmdImageList) run(cmd *cobra.Command, args []string) error {
return err
}

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

// Process the filters
filters := []string{}
if name != "" {
Expand All @@ -1378,6 +1373,11 @@ func (c *cmdImageList) run(cmd *cobra.Command, args []string) error {

var allImages []api.Image
if c.flagAllProjects {
d, err := c.global.conf.GetInstanceServer(remoteName)
if err != nil {
return err
}

allImages, err = d.GetImagesAllProjectsWithFilter(serverFilters)
if err != nil {
allImages, err = d.GetImagesAllProjects()
Expand Down

0 comments on commit 2747305

Please sign in to comment.