summaryrefslogtreecommitdiff
path: root/pkg/domain/infra/abi/network.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-01-19 16:56:17 -0500
committerGitHub <noreply@github.com>2021-01-19 16:56:17 -0500
commit5e7262ddf595f9187d01e12f5dcee2fe1c713798 (patch)
tree6cde028a76610dfc85eb7e27af7743af2e9842bb /pkg/domain/infra/abi/network.go
parent37470c4d200c5cde2f8e233dbaa6d200d94919cc (diff)
parenta45d22a1ddd2840cf8c3a38540aa8683cc0d5c7d (diff)
downloadpodman-5e7262ddf595f9187d01e12f5dcee2fe1c713798.tar.gz
podman-5e7262ddf595f9187d01e12f5dcee2fe1c713798.tar.bz2
podman-5e7262ddf595f9187d01e12f5dcee2fe1c713798.zip
Merge pull request #9021 from Luap99/podman-network-exists
podman network exists
Diffstat (limited to 'pkg/domain/infra/abi/network.go')
-rw-r--r--pkg/domain/infra/abi/network.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/pkg/domain/infra/abi/network.go b/pkg/domain/infra/abi/network.go
index e5ecf5c72..bc4328fcd 100644
--- a/pkg/domain/infra/abi/network.go
+++ b/pkg/domain/infra/abi/network.go
@@ -140,3 +140,18 @@ func (ic *ContainerEngine) NetworkDisconnect(ctx context.Context, networkname st
func (ic *ContainerEngine) NetworkConnect(ctx context.Context, networkname string, options entities.NetworkConnectOptions) error {
return ic.Libpod.ConnectContainerToNetwork(options.Container, networkname, options.Aliases)
}
+
+// NetworkExists checks if the given network exists
+func (ic *ContainerEngine) NetworkExists(ctx context.Context, networkname string) (*entities.BoolReport, error) {
+ config, err := ic.Libpod.GetConfig()
+ if err != nil {
+ return nil, err
+ }
+ exists, err := network.Exists(config, networkname)
+ if err != nil {
+ return nil, err
+ }
+ return &entities.BoolReport{
+ Value: exists,
+ }, nil
+}