diff options
author | Daniel J Walsh <dwalsh@redhat.com> | 2021-09-30 14:43:39 -0400 |
---|---|---|
committer | Daniel J Walsh <dwalsh@redhat.com> | 2021-10-04 07:07:56 -0400 |
commit | 21c9dc3c406bb486c44c4a27e5b0497bab1cd40d (patch) | |
tree | 56793ffd885f835fa54013e9914844ff9ba20d92 /pkg/domain/infra/abi/containers.go | |
parent | 36821d302e3787a42d6eefdbd0bdbb6d9da261fb (diff) | |
download | podman-21c9dc3c406bb486c44c4a27e5b0497bab1cd40d.tar.gz podman-21c9dc3c406bb486c44c4a27e5b0497bab1cd40d.tar.bz2 podman-21c9dc3c406bb486c44c4a27e5b0497bab1cd40d.zip |
Add --time out for podman * rm -f commands
Add --time flag to podman container rm
Add --time flag to podman pod rm
Add --time flag to podman volume rm
Add --time flag to podman network rm
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'pkg/domain/infra/abi/containers.go')
-rw-r--r-- | pkg/domain/infra/abi/containers.go | 11 |
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()) } |