aboutsummaryrefslogtreecommitdiff
path: root/cmd/podman/networks/rm.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2022-07-27 14:10:19 -0400
committerGitHub <noreply@github.com>2022-07-27 14:10:19 -0400
commit432348e8e4e95d32bb26ceca4d467ff9f726dd89 (patch)
treeb1551e08b62c37dc7ca7a0ce3f32e839802ed197 /cmd/podman/networks/rm.go
parenteea8e570f2af82944e61410e5e7dd9b540feae34 (diff)
parent75419c5d887e23f93a465311b02bb76d8cea1940 (diff)
downloadpodman-432348e8e4e95d32bb26ceca4d467ff9f726dd89.tar.gz
podman-432348e8e4e95d32bb26ceca4d467ff9f726dd89.tar.bz2
podman-432348e8e4e95d32bb26ceca4d467ff9f726dd89.zip
Merge pull request #14959 from rhatdan/rm
When removing objects specifying --force,podman should exit with 0
Diffstat (limited to 'cmd/podman/networks/rm.go')
-rw-r--r--cmd/podman/networks/rm.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/cmd/podman/networks/rm.go b/cmd/podman/networks/rm.go
index c2d3f655f..d734b2867 100644
--- a/cmd/podman/networks/rm.go
+++ b/cmd/podman/networks/rm.go
@@ -63,6 +63,9 @@ func networkRm(cmd *cobra.Command, args []string) error {
}
responses, err := registry.ContainerEngine().NetworkRm(registry.Context(), args, networkRmOptions)
if err != nil {
+ if networkRmOptions.Force && strings.Contains(err.Error(), define.ErrNoSuchNetwork.Error()) {
+ return nil
+ }
setExitCode(err)
return err
}
@@ -70,6 +73,9 @@ func networkRm(cmd *cobra.Command, args []string) error {
if r.Err == nil {
fmt.Println(r.Name)
} else {
+ if networkRmOptions.Force && strings.Contains(r.Err.Error(), define.ErrNoSuchNetwork.Error()) {
+ continue
+ }
setExitCode(r.Err)
errs = append(errs, r.Err)
}