summaryrefslogtreecommitdiff
path: root/pkg/domain/infra/abi/containers.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-10-04 15:10:36 -0400
committerGitHub <noreply@github.com>2021-10-04 15:10:36 -0400
commita866a2f159f94976277d8a3a9459724af0b0f62f (patch)
tree341b34bcd9dc87efada13a522bb21c31097fef8a /pkg/domain/infra/abi/containers.go
parent2f72f17a114f4e20b56deb2c21908d1d4610919c (diff)
parent21c9dc3c406bb486c44c4a27e5b0497bab1cd40d (diff)
downloadpodman-a866a2f159f94976277d8a3a9459724af0b0f62f.tar.gz
podman-a866a2f159f94976277d8a3a9459724af0b0f62f.tar.bz2
podman-a866a2f159f94976277d8a3a9459724af0b0f62f.zip
Merge pull request #11763 from rhatdan/timeout
Add --time option for podman * rm -f flag
Diffstat (limited to 'pkg/domain/infra/abi/containers.go')
-rw-r--r--pkg/domain/infra/abi/containers.go11
1 files changed, 7 insertions, 4 deletions
diff --git a/pkg/domain/infra/abi/containers.go b/pkg/domain/infra/abi/containers.go
index 8e7e2d411..6ca142618 100644
--- a/pkg/domain/infra/abi/containers.go
+++ b/pkg/domain/infra/abi/containers.go
@@ -283,7 +283,7 @@ func (ic *ContainerEngine) ContainerRestart(ctx context.Context, namesOrIds []st
}
func (ic *ContainerEngine) removeContainer(ctx context.Context, ctr *libpod.Container, options entities.RmOptions) error {
- err := ic.Libpod.RemoveContainer(ctx, ctr, options.Force, options.Volumes)
+ err := ic.Libpod.RemoveContainer(ctx, ctr, options.Force, options.Volumes, options.Timeout)
if err == nil {
return nil
}
@@ -963,7 +963,8 @@ func (ic *ContainerEngine) ContainerRun(ctx context.Context, opts entities.Conta
return &report, nil
}
if opts.Rm {
- if deleteError := ic.Libpod.RemoveContainer(ctx, ctr, true, false); deleteError != nil {
+ var timeout *uint
+ if deleteError := ic.Libpod.RemoveContainer(ctx, ctr, true, false, timeout); deleteError != nil {
logrus.Debugf("unable to remove container %s after failing to start and attach to it", ctr.ID())
}
}
@@ -977,7 +978,8 @@ func (ic *ContainerEngine) ContainerRun(ctx context.Context, opts entities.Conta
}
report.ExitCode = ic.GetContainerExitCode(ctx, ctr)
if opts.Rm && !ctr.ShouldRestart(ctx) {
- if err := ic.Libpod.RemoveContainer(ctx, ctr, false, true); err != nil {
+ var timeout *uint
+ if err := ic.Libpod.RemoveContainer(ctx, ctr, false, true, timeout); err != nil {
if errors.Cause(err) == define.ErrNoSuchCtr ||
errors.Cause(err) == define.ErrCtrRemoved {
logrus.Infof("Container %s was already removed, skipping --rm", ctr.ID())
@@ -1082,7 +1084,8 @@ func (ic *ContainerEngine) ContainerCleanup(ctx context.Context, namesOrIds []st
}
if options.Remove && !ctr.ShouldRestart(ctx) {
- err = ic.Libpod.RemoveContainer(ctx, ctr, false, true)
+ var timeout *uint
+ err = ic.Libpod.RemoveContainer(ctx, ctr, false, true, timeout)
if err != nil {
report.RmErr = errors.Wrapf(err, "failed to cleanup and remove container %v", ctr.ID())
}