From 80131339b7c34431e382083ef18daa6b85251d64 Mon Sep 17 00:00:00 2001 From: Matthew Heon Date: Tue, 26 Jun 2018 13:30:39 -0400 Subject: Mark containers invalid earlier during removal Fixes a bug where we might try saving back to the database during cleanup, which would fail as the container was already removed from the database. Signed-off-by: Matthew Heon Closes: #1001 Approved by: rhatdan --- libpod/runtime_ctr.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libpod/runtime_ctr.go b/libpod/runtime_ctr.go index aa49b2d51..932bebdef 100644 --- a/libpod/runtime_ctr.go +++ b/libpod/runtime_ctr.go @@ -258,6 +258,9 @@ func (r *Runtime) removeContainer(ctx context.Context, c *Container, force bool) } } + // Set container as invalid so it can no longer be used + c.valid = false + // Clean up network namespace, cgroups, mounts if err := c.cleanup(); err != nil { if cleanupErr == nil { @@ -289,9 +292,6 @@ func (r *Runtime) removeContainer(ctx context.Context, c *Container, force bool) } } - // Set container as invalid so it can no longer be used - c.valid = false - return cleanupErr } -- cgit v1.2.3-54-g00ecf