From a45d22a1ddd2840cf8c3a38540aa8683cc0d5c7d Mon Sep 17 00:00:00 2001 From: Paul Holzinger Date: Mon, 18 Jan 2021 18:52:06 +0100 Subject: podman network exists Add podman network exists command with remote support. Signed-off-by: Paul Holzinger --- pkg/domain/infra/tunnel/network.go | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'pkg/domain/infra/tunnel') diff --git a/pkg/domain/infra/tunnel/network.go b/pkg/domain/infra/tunnel/network.go index d4e827580..bdb1beb03 100644 --- a/pkg/domain/infra/tunnel/network.go +++ b/pkg/domain/infra/tunnel/network.go @@ -78,3 +78,14 @@ func (ic *ContainerEngine) NetworkConnect(ctx context.Context, networkname strin options := new(network.ConnectOptions).WithAliases(opts.Aliases) return network.Connect(ic.ClientCtx, networkname, opts.Container, options) } + +// NetworkExists checks if the given network exists +func (ic *ContainerEngine) NetworkExists(ctx context.Context, networkname string) (*entities.BoolReport, error) { + exists, err := network.Exists(ic.ClientCtx, networkname, nil) + if err != nil { + return nil, err + } + return &entities.BoolReport{ + Value: exists, + }, nil +} -- cgit v1.2.3-54-g00ecf