diff options
author | Paul Holzinger <paul.holzinger@web.de> | 2021-01-22 14:09:55 +0100 |
---|---|---|
committer | Paul Holzinger <paul.holzinger@web.de> | 2021-01-22 20:19:13 +0100 |
commit | 6e6a38b4168ed7a528614f6499783243a8668395 (patch) | |
tree | 4389f13d6407233e77c84d3557f63bc0fdbc51b2 /pkg/api/handlers/libpod | |
parent | f02aba659447ea9198851231d7f11a8bfdfe69ba (diff) | |
download | podman-6e6a38b4168ed7a528614f6499783243a8668395.tar.gz podman-6e6a38b4168ed7a528614f6499783243a8668395.tar.bz2 podman-6e6a38b4168ed7a528614f6499783243a8668395.zip |
podman manifest exists
Add podman manifest exists command with remote support.
Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
Diffstat (limited to 'pkg/api/handlers/libpod')
-rw-r--r-- | pkg/api/handlers/libpod/manifests.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/pkg/api/handlers/libpod/manifests.go b/pkg/api/handlers/libpod/manifests.go index dce861f6f..35221ecf1 100644 --- a/pkg/api/handlers/libpod/manifests.go +++ b/pkg/api/handlers/libpod/manifests.go @@ -48,6 +48,24 @@ func ManifestCreate(w http.ResponseWriter, r *http.Request) { utils.WriteResponse(w, http.StatusOK, handlers.IDResponse{ID: manID}) } +// ExistsManifest check if a manifest list exists +func ExistsManifest(w http.ResponseWriter, r *http.Request) { + runtime := r.Context().Value("runtime").(*libpod.Runtime) + name := utils.GetName(r) + + ic := abi.ImageEngine{Libpod: runtime} + report, err := ic.ManifestExists(r.Context(), name) + if err != nil { + utils.Error(w, "Something went wrong.", http.StatusInternalServerError, err) + return + } + if !report.Value { + utils.Error(w, "manifest not found", http.StatusNotFound, errors.New("manifest not found")) + return + } + utils.WriteResponse(w, http.StatusNoContent, "") +} + func ManifestInspect(w http.ResponseWriter, r *http.Request) { runtime := r.Context().Value("runtime").(*libpod.Runtime) name := utils.GetName(r) |