aboutsummaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorQi Wang <qiwan@redhat.com>2019-11-04 15:07:24 -0500
committerQi Wang <qiwan@redhat.com>2019-11-26 13:19:31 -0500
commitd9400cced2afad61eafa18da661891a96db1eafc (patch)
tree6672d5b506ac9355eabdca1804dc62060ac91867 /pkg
parentf5ef3d59bcc7e7beae8716ab10153e1eafd634c1 (diff)
downloadpodman-d9400cced2afad61eafa18da661891a96db1eafc.tar.gz
podman-d9400cced2afad61eafa18da661891a96db1eafc.tar.bz2
podman-d9400cced2afad61eafa18da661891a96db1eafc.zip
Remove containers when pruning a stopped pod.
This path allows pod prune & pod rm to remove stopped containers in the pod before deleting the pod. PrunePods and RemovePod should be able to remove containers without force removal of stopped pods. Signed-off-by: Qi Wang <qiwan@redhat.com>
Diffstat (limited to 'pkg')
-rw-r--r--pkg/adapter/pods.go4
-rw-r--r--pkg/varlinkapi/pods.go2
2 files changed, 3 insertions, 3 deletions
diff --git a/pkg/adapter/pods.go b/pkg/adapter/pods.go
index e9f3d41a9..a726153c0 100644
--- a/pkg/adapter/pods.go
+++ b/pkg/adapter/pods.go
@@ -77,7 +77,7 @@ func (r *LocalRuntime) PrunePods(ctx context.Context, cli *cliconfig.PodPruneVal
pool.Add(shared.Job{
ID: p.ID(),
Fn: func() error {
- err := r.Runtime.RemovePod(ctx, p, cli.Force, cli.Force)
+ err := r.Runtime.RemovePod(ctx, p, true, cli.Force)
if err != nil {
logrus.Debugf("Failed to remove pod %s: %s", p.ID(), err.Error())
}
@@ -101,7 +101,7 @@ func (r *LocalRuntime) RemovePods(ctx context.Context, cli *cliconfig.PodRmValue
}
for _, p := range pods {
- if err := r.Runtime.RemovePod(ctx, p, cli.Force, cli.Force); err != nil {
+ if err := r.Runtime.RemovePod(ctx, p, true, cli.Force); err != nil {
errs = append(errs, err)
} else {
podids = append(podids, p.ID())
diff --git a/pkg/varlinkapi/pods.go b/pkg/varlinkapi/pods.go
index 9b659f66b..1ebe5d424 100644
--- a/pkg/varlinkapi/pods.go
+++ b/pkg/varlinkapi/pods.go
@@ -247,7 +247,7 @@ func (i *LibpodAPI) RemovePod(call iopodman.VarlinkCall, name string, force bool
if err != nil {
return call.ReplyPodNotFound(name, err.Error())
}
- if err = i.Runtime.RemovePod(ctx, pod, force, force); err != nil {
+ if err = i.Runtime.RemovePod(ctx, pod, true, force); err != nil {
return call.ReplyErrorOccurred(err.Error())
}