diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2019-02-11 20:31:03 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-11 20:31:03 +0100 |
commit | b7a3685cbae421bfd882c7c592b1721071cde984 (patch) | |
tree | afd620f98d18bdbb35cd584758332ad0dae62670 /cmd | |
parent | 112a5ab20cd6a07bcfcccadd0c0b851927a16f05 (diff) | |
parent | 233ba5bd894aac77db1bb2e41b0ef464f865d2a0 (diff) | |
download | podman-b7a3685cbae421bfd882c7c592b1721071cde984.tar.gz podman-b7a3685cbae421bfd882c7c592b1721071cde984.tar.bz2 podman-b7a3685cbae421bfd882c7c592b1721071cde984.zip |
Merge pull request #2281 from rhatdan/deleteContainer
Remove container from storage on --force
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/podman/rm.go | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/cmd/podman/rm.go b/cmd/podman/rm.go index bb9a913c9..ab2a29e07 100644 --- a/cmd/podman/rm.go +++ b/cmd/podman/rm.go @@ -6,6 +6,7 @@ import ( "github.com/containers/libpod/cmd/podman/cliconfig" "github.com/containers/libpod/cmd/podman/libpodruntime" "github.com/containers/libpod/cmd/podman/shared" + "github.com/containers/libpod/libpod" "github.com/pkg/errors" "github.com/sirupsen/logrus" "github.com/spf13/cobra" @@ -61,10 +62,18 @@ func rmCmd(c *cliconfig.RmValues) error { delContainers, err := getAllOrLatestContainers(&c.PodmanCommand, runtime, -1, "all") if err != nil { + if c.Force && len(c.InputArgs) > 0 { + if errors.Cause(err) == libpod.ErrNoSuchCtr { + err = nil + } + runtime.RemoveContainersFromStorage(c.InputArgs) + } if len(delContainers) == 0 { return err } - fmt.Println(err.Error()) + if err != nil { + fmt.Println(err.Error()) + } } for _, container := range delContainers { |