diff options
author | baude <bbaude@redhat.com> | 2018-04-03 10:43:58 -0500 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2018-04-03 18:37:41 +0000 |
commit | b1a8d769b84c52ea5ea74263cff6f582b1bdfcf0 (patch) | |
tree | 790e3b39a5995951c8834d3a6229882149343e7a /libpod/container_api.go | |
parent | 4640e7966769a128b30c2482cda8f3ef25eb77c9 (diff) | |
download | podman-b1a8d769b84c52ea5ea74263cff6f582b1bdfcf0.tar.gz podman-b1a8d769b84c52ea5ea74263cff6f582b1bdfcf0.tar.bz2 podman-b1a8d769b84c52ea5ea74263cff6f582b1bdfcf0.zip |
Stopping a stopped container should not be an error
Resolves: #575
Signed-off-by: baude <bbaude@redhat.com>
Closes: #588
Approved by: mheon
Diffstat (limited to 'libpod/container_api.go')
-rw-r--r-- | libpod/container_api.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libpod/container_api.go b/libpod/container_api.go index 41e754587..6106cfc12 100644 --- a/libpod/container_api.go +++ b/libpod/container_api.go @@ -215,6 +215,10 @@ func (c *Container) Stop() error { return errors.Wrapf(ErrCtrStateInvalid, "can only stop created, running, or stopped containers") } + if c.state.State == ContainerStateStopped { + return ErrCtrStopped + } + return c.stop(c.config.StopTimeout) } @@ -237,6 +241,10 @@ func (c *Container) StopWithTimeout(timeout uint) error { return errors.Wrapf(ErrCtrStateInvalid, "can only stop created, running, or stopped containers") } + if c.state.State == ContainerStateStopped { + return ErrCtrStopped + } + return c.stop(timeout) } |