mirror of
https://github.com/containers/podman.git
synced 2025-08-06 11:32:07 +08:00
Stopping a stopped container should not be an error
Resolves: #575 Signed-off-by: baude <bbaude@redhat.com> Closes: #588 Approved by: mheon
This commit is contained in:
@ -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)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user