summaryrefslogtreecommitdiff
path: root/cmd/podman/pods/rm.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-06-15 12:54:36 -0400
committerGitHub <noreply@github.com>2020-06-15 12:54:36 -0400
commit10c6c806ea6d7830c248d9c89cd5ec3a7a515a63 (patch)
tree837474da079889daa027b66e5239915dd983f7ab /cmd/podman/pods/rm.go
parentb89729778c253f0eccd2dd762e5d0a6547aaea7d (diff)
parent6118ab494884eea62c388fa1536349f05cdac9d3 (diff)
downloadpodman-10c6c806ea6d7830c248d9c89cd5ec3a7a515a63.tar.gz
podman-10c6c806ea6d7830c248d9c89cd5ec3a7a515a63.tar.bz2
podman-10c6c806ea6d7830c248d9c89cd5ec3a7a515a63.zip
Merge pull request #6553 from vrothberg/replace
--replace for containers and pods
Diffstat (limited to 'cmd/podman/pods/rm.go')
-rw-r--r--cmd/podman/pods/rm.go18
1 files changed, 12 insertions, 6 deletions
diff --git a/cmd/podman/pods/rm.go b/cmd/podman/pods/rm.go
index 8de0bce9e..ec8dae1d1 100644
--- a/cmd/podman/pods/rm.go
+++ b/cmd/podman/pods/rm.go
@@ -58,24 +58,30 @@ func init() {
}
func rm(cmd *cobra.Command, args []string) error {
- var (
- errs utils.OutputErrors
- )
-
ids, err := common.ReadPodIDFiles(rmOptions.PodIDFiles)
if err != nil {
return err
}
args = append(args, ids...)
+ return removePods(args, rmOptions.PodRmOptions, true)
+}
- responses, err := registry.ContainerEngine().PodRm(context.Background(), args, rmOptions.PodRmOptions)
+// removePods removes the specified pods (names or IDs). Allows for sharing
+// pod-removal logic across commands.
+func removePods(namesOrIDs []string, rmOptions entities.PodRmOptions, printIDs bool) error {
+ var errs utils.OutputErrors
+
+ responses, err := registry.ContainerEngine().PodRm(context.Background(), namesOrIDs, rmOptions)
if err != nil {
return err
}
+
// in the cli, first we print out all the successful attempts
for _, r := range responses {
if r.Err == nil {
- fmt.Println(r.Id)
+ if printIDs {
+ fmt.Println(r.Id)
+ }
} else {
errs = append(errs, r.Err)
}