summaryrefslogtreecommitdiff
path: root/pkg/domain/infra/abi
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-03-05 09:50:03 -0500
committerGitHub <noreply@github.com>2021-03-05 09:50:03 -0500
commit0bac30d724643cf84d49e643a17bd8fd304efde1 (patch)
treede5451b8395102acb8ecfaf6d53232307be6a2db /pkg/domain/infra/abi
parentc6cefa5f0450a433044ac2d002e4c77ba9e3614b (diff)
parent2bcc95257fcbb6d9d20c24c8bcb9de86f0362b15 (diff)
downloadpodman-0bac30d724643cf84d49e643a17bd8fd304efde1.tar.gz
podman-0bac30d724643cf84d49e643a17bd8fd304efde1.tar.bz2
podman-0bac30d724643cf84d49e643a17bd8fd304efde1.zip
Merge pull request #9622 from jmguzik/network-rm-fix
Fix podman network rm (-f) workflow
Diffstat (limited to 'pkg/domain/infra/abi')
-rw-r--r--pkg/domain/infra/abi/network.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/pkg/domain/infra/abi/network.go b/pkg/domain/infra/abi/network.go
index 50a74032c..edde8ece6 100644
--- a/pkg/domain/infra/abi/network.go
+++ b/pkg/domain/infra/abi/network.go
@@ -96,7 +96,15 @@ func (ic *ContainerEngine) NetworkRm(ctx context.Context, namesOrIds []string, o
}
// We need to iterate containers looking to see if they belong to the given network
for _, c := range containers {
- if util.StringInSlice(name, c.Config().Networks) {
+ networks, _, err := c.Networks()
+ // if container vanished or network does not exist, go to next container
+ if errors.Is(err, define.ErrNoSuchNetwork) || errors.Is(err, define.ErrNoSuchCtr) {
+ continue
+ }
+ if err != nil {
+ return reports, err
+ }
+ if util.StringInSlice(name, networks) {
// if user passes force, we nuke containers and pods
if !options.Force {
// Without the force option, we return an error