summaryrefslogtreecommitdiff
path: root/pkg/api/handlers/compat/images.go
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2020-10-13 12:11:52 -0500
committerbaude <bbaude@redhat.com>2020-10-13 12:11:52 -0500
commitef5c8846737f4c9697f34bd920718d2b1292ad49 (patch)
tree8bb0a0922d246739a28b58ceb8a3ea8e85baaa8f /pkg/api/handlers/compat/images.go
parent7ad631b819d991559ba20e4728a6803a2546158f (diff)
downloadpodman-ef5c8846737f4c9697f34bd920718d2b1292ad49.tar.gz
podman-ef5c8846737f4c9697f34bd920718d2b1292ad49.tar.bz2
podman-ef5c8846737f4c9697f34bd920718d2b1292ad49.zip
alter compat no such image message
we need to alter the return error message when a GET (inspect) is performed on an image using the compatibility layer. docker-py bindings look for a initial capped error message. Signed-off-by: baude <bbaude@redhat.com>
Diffstat (limited to 'pkg/api/handlers/compat/images.go')
-rw-r--r--pkg/api/handlers/compat/images.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/pkg/api/handlers/compat/images.go b/pkg/api/handlers/compat/images.go
index f49ce59da..3431823bd 100644
--- a/pkg/api/handlers/compat/images.go
+++ b/pkg/api/handlers/compat/images.go
@@ -327,7 +327,10 @@ func GetImage(w http.ResponseWriter, r *http.Request) {
name := utils.GetName(r)
newImage, err := utils.GetImage(r, name)
if err != nil {
- utils.Error(w, "Something went wrong.", http.StatusNotFound, errors.Wrapf(err, "failed to find image %s", name))
+ // Here we need to fiddle with the error message because docker-py is looking for "No
+ // such image" to determine on how to raise the correct exception.
+ errMsg := strings.ReplaceAll(err.Error(), "no such image", "No such image")
+ utils.Error(w, "Something went wrong.", http.StatusNotFound, errors.Errorf("failed to find image %s: %s", name, errMsg))
return
}
inspect, err := handlers.ImageDataToImageInspect(r.Context(), newImage)