summaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@gmail.com>2018-10-02 13:39:33 -0400
committerMatthew Heon <matthew.heon@gmail.com>2018-10-02 13:47:53 -0400
commit7e23fb6c5d252c61125388ec3c7e1313b7f6bb85 (patch)
tree0a912785ed3e9b8ddc881e308ec3216872ae6fad /libpod
parent39d7c869ea9291352e836f3c170d9bd801f9c35c (diff)
downloadpodman-7e23fb6c5d252c61125388ec3c7e1313b7f6bb85.tar.gz
podman-7e23fb6c5d252c61125388ec3c7e1313b7f6bb85.tar.bz2
podman-7e23fb6c5d252c61125388ec3c7e1313b7f6bb85.zip
Fix cleanupRuntime to only save if container is valid
We call cleanup() (which calls cleanupRuntime()) as part of removing containers, after the container has already been removed from the database. cleanupRuntime() tries to update and save the state, which obviously fails if the container no longer exists. Make the save() conditional on the container not being in the process of being removed. Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
Diffstat (limited to 'libpod')
-rw-r--r--libpod/container_internal.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/libpod/container_internal.go b/libpod/container_internal.go
index 60e83576a..c2ed67a82 100644
--- a/libpod/container_internal.go
+++ b/libpod/container_internal.go
@@ -561,8 +561,11 @@ func (c *Container) cleanupRuntime(ctx context.Context) error {
// Our state is now Exited, as we've removed ourself from
// the runtime.
c.state.State = ContainerStateExited
- if err := c.save(); err != nil {
- return err
+
+ if c.valid {
+ if err := c.save(); err != nil {
+ return err
+ }
}
logrus.Debugf("Successfully cleaned up container %s", c.ID())