From b1a8d769b84c52ea5ea74263cff6f582b1bdfcf0 Mon Sep 17 00:00:00 2001 From: baude Date: Tue, 3 Apr 2018 10:43:58 -0500 Subject: Stopping a stopped container should not be an error Resolves: #575 Signed-off-by: baude Closes: #588 Approved by: mheon --- libpod/container_api.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'libpod/container_api.go') 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) } -- cgit v1.2.3-54-g00ecf