diff options
author | W. Trevor King <wking@tremily.us> | 2018-05-31 11:47:17 -0700 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2018-06-04 18:36:40 +0000 |
commit | c9f763456cd8263c3f2d84c6b2b6e17ad81cf3ba (patch) | |
tree | b1cffd82978145f372893f62754432d75003b31d /libpod/runtime_ctr.go | |
parent | 28d1cec9f64cca11d42410c6e33c43b01b1d7678 (diff) | |
download | podman-c9f763456cd8263c3f2d84c6b2b6e17ad81cf3ba.tar.gz podman-c9f763456cd8263c3f2d84c6b2b6e17ad81cf3ba.tar.bz2 podman-c9f763456cd8263c3f2d84c6b2b6e17ad81cf3ba.zip |
libpod: Execute poststop hooks locally
Instead of delegating to the runtime, since some runtimes do not seem
to handle these reliably [1].
[1]: https://github.com/projectatomic/libpod/issues/730#issuecomment-392959938
Signed-off-by: W. Trevor King <wking@tremily.us>
Closes: #864
Approved by: rhatdan
Diffstat (limited to 'libpod/runtime_ctr.go')
-rw-r--r-- | libpod/runtime_ctr.go | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/libpod/runtime_ctr.go b/libpod/runtime_ctr.go index c6973ff2a..bde9db764 100644 --- a/libpod/runtime_ctr.go +++ b/libpod/runtime_ctr.go @@ -154,16 +154,16 @@ func (r *Runtime) NewContainer(ctx context.Context, rSpec *spec.Spec, options .. // RemoveContainer removes the given container // If force is specified, the container will be stopped first // Otherwise, RemoveContainer will return an error if the container is running -func (r *Runtime) RemoveContainer(c *Container, force bool) error { +func (r *Runtime) RemoveContainer(ctx context.Context, c *Container, force bool) error { r.lock.Lock() defer r.lock.Unlock() - return r.removeContainer(c, force) + return r.removeContainer(ctx, c, force) } // Internal function to remove a container // Locks the container, but does not lock the runtime -func (r *Runtime) removeContainer(c *Container, force bool) error { +func (r *Runtime) removeContainer(ctx context.Context, c *Container, force bool) error { if !c.valid { // Container probably already removed // Or was never in the runtime to begin with @@ -263,8 +263,9 @@ func (r *Runtime) removeContainer(c *Container, force bool) error { // Only do this if we're not ContainerStateConfigured - if we are, // we haven't been created in the runtime yet if c.state.State != ContainerStateConfigured { - if err := r.ociRuntime.deleteContainer(c); err != nil { - return errors.Wrapf(err, "error removing container %s from OCI runtime", c.ID()) + err = c.delete(ctx) + if err != nil { + return err } } |