From 0686b2226636ae2a5546710248baf5d15ff894f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20L=C3=A9one?= Date: Thu, 26 Dec 2024 14:13:46 +0100 Subject: [PATCH] Fix: image list with zone=all (#4382) --- internal/namespaces/instance/v1/custom_image.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/internal/namespaces/instance/v1/custom_image.go b/internal/namespaces/instance/v1/custom_image.go index 571b9ee36..7f624fd8d 100644 --- a/internal/namespaces/instance/v1/custom_image.go +++ b/internal/namespaces/instance/v1/custom_image.go @@ -188,7 +188,14 @@ func imageListBuilder(c *core.Command) *core.Command { req.Public = scw.BoolPtr(false) client := core.ExtractClient(ctx) api := instance.NewAPI(client) - listImagesResponse, err := api.ListImages(req, scw.WithAllPages()) + + opts := []scw.RequestOption{scw.WithAllPages()} + if req.Zone == scw.Zone(core.AllLocalities) { + opts = append(opts, scw.WithZones(api.Zones()...)) + req.Zone = "" + } + + listImagesResponse, err := api.ListImages(req, opts...) if err != nil { return nil, err }