From 9d31fed5f75186f618e95ab7492ef6bc2b511d5f Mon Sep 17 00:00:00 2001 From: Paul Holzinger Date: Tue, 19 Jan 2021 23:03:51 +0100 Subject: podman volume exists Add podman volume exists command with remote support. Signed-off-by: Paul Holzinger --- pkg/domain/infra/tunnel/volumes.go | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'pkg/domain/infra/tunnel') diff --git a/pkg/domain/infra/tunnel/volumes.go b/pkg/domain/infra/tunnel/volumes.go index f21336828..ffd2c1d35 100644 --- a/pkg/domain/infra/tunnel/volumes.go +++ b/pkg/domain/infra/tunnel/volumes.go @@ -80,3 +80,14 @@ func (ic *ContainerEngine) VolumeList(ctx context.Context, opts entities.VolumeL options := new(volumes.ListOptions).WithFilters(opts.Filter) return volumes.List(ic.ClientCtx, options) } + +// VolumeExists checks if the given volume exists +func (ic *ContainerEngine) VolumeExists(ctx context.Context, nameOrID string) (*entities.BoolReport, error) { + exists, err := volumes.Exists(ic.ClientCtx, nameOrID, nil) + if err != nil { + return nil, err + } + return &entities.BoolReport{ + Value: exists, + }, nil +} -- cgit v1.2.3-54-g00ecf