Skip to content

Commit

Permalink
Do not delete container twice
Browse files Browse the repository at this point in the history
10 lines above we had

	// Set ContainerStateRemoving
	c.state.State = define.ContainerStateRemoving

Which causes the state to not be the two checked states.  Since the
c.cleanup call already deleted the OCI state, this meant that we were
calling cleanup, and hence the postHook hook twice.

Fixes: containers#9983

[NO TESTS NEEDED] Since it would be difficult to tests this.  Main tests
should handle that the container is being deleted successfully.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
  • Loading branch information
rhatdan authored and jmguzik committed Apr 26, 2021
1 parent 6777781 commit c993612
Showing 1 changed file with 0 additions and 14 deletions.
14 changes: 0 additions & 14 deletions libpod/runtime_ctr.go
Original file line number Diff line number Diff line change
Expand Up @@ -616,20 +616,6 @@ func (r *Runtime) removeContainer(ctx context.Context, c *Container, force, remo
}
}

// Delete the container.
// Not needed in Configured and Exited states, where the container
// doesn't exist in the runtime
if c.state.State != define.ContainerStateConfigured &&
c.state.State != define.ContainerStateExited {
if err := c.delete(ctx); err != nil {
if cleanupErr == nil {
cleanupErr = err
} else {
logrus.Errorf("delete container: %v", err)
}
}
}

// Remove the container from the state
if c.config.Pod != "" {
// If we're removing the pod, the container will be evicted
Expand Down

0 comments on commit c993612

Please sign in to comment.