From 6e6a38b4168ed7a528614f6499783243a8668395 Mon Sep 17 00:00:00 2001 From: Paul Holzinger Date: Fri, 22 Jan 2021 14:09:55 +0100 Subject: podman manifest exists Add podman manifest exists command with remote support. Signed-off-by: Paul Holzinger --- pkg/domain/infra/abi/manifest.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'pkg/domain/infra/abi') diff --git a/pkg/domain/infra/abi/manifest.go b/pkg/domain/infra/abi/manifest.go index 139032ad6..626f1f7bf 100644 --- a/pkg/domain/infra/abi/manifest.go +++ b/pkg/domain/infra/abi/manifest.go @@ -40,6 +40,18 @@ func (ir *ImageEngine) ManifestCreate(ctx context.Context, names, images []strin return imageID, err } +// ManifestExists checks if a manifest list with the given name exists in local storage +func (ir *ImageEngine) ManifestExists(ctx context.Context, name string) (*entities.BoolReport, error) { + if image, err := ir.Libpod.ImageRuntime().NewFromLocal(name); err == nil { + exists, err := image.ExistsManifest() + if err != nil && errors.Cause(err) != buildahManifests.ErrManifestTypeNotSupported { + return nil, err + } + return &entities.BoolReport{Value: exists}, nil + } + return &entities.BoolReport{Value: false}, nil +} + // ManifestInspect returns the content of a manifest list or image func (ir *ImageEngine) ManifestInspect(ctx context.Context, name string) ([]byte, error) { if newImage, err := ir.Libpod.ImageRuntime().NewFromLocal(name); err == nil { -- cgit v1.2.3-54-g00ecf