mirror of
https://github.com/containers/podman.git
synced 2025-07-01 08:07:03 +08:00
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
This commit is contained in:

committed by
Atomic Bot

parent
28d1cec9f6
commit
c9f763456c
@ -409,6 +409,7 @@ func (i *LibpodAPI) WaitContainer(call ioprojectatomicpodman.VarlinkCall, name s
|
||||
|
||||
// RemoveContainer ...
|
||||
func (i *LibpodAPI) RemoveContainer(call ioprojectatomicpodman.VarlinkCall, name string, force bool) error {
|
||||
ctx := getContext()
|
||||
runtime, err := libpodruntime.GetRuntime(i.Cli)
|
||||
if err != nil {
|
||||
return call.ReplyRuntimeError(err.Error())
|
||||
@ -417,7 +418,7 @@ func (i *LibpodAPI) RemoveContainer(call ioprojectatomicpodman.VarlinkCall, name
|
||||
if err != nil {
|
||||
return call.ReplyContainerNotFound(name)
|
||||
}
|
||||
if err := runtime.RemoveContainer(ctr, force); err != nil {
|
||||
if err := runtime.RemoveContainer(ctx, ctr, force); err != nil {
|
||||
return call.ReplyErrorOccurred(err.Error())
|
||||
}
|
||||
return call.ReplyRemoveContainer(ctr.ID())
|
||||
@ -426,6 +427,7 @@ func (i *LibpodAPI) RemoveContainer(call ioprojectatomicpodman.VarlinkCall, name
|
||||
|
||||
// DeleteStoppedContainers ...
|
||||
func (i *LibpodAPI) DeleteStoppedContainers(call ioprojectatomicpodman.VarlinkCall) error {
|
||||
ctx := getContext()
|
||||
var deletedContainers []string
|
||||
runtime, err := libpodruntime.GetRuntime(i.Cli)
|
||||
if err != nil {
|
||||
@ -441,7 +443,7 @@ func (i *LibpodAPI) DeleteStoppedContainers(call ioprojectatomicpodman.VarlinkCa
|
||||
return call.ReplyErrorOccurred(err.Error())
|
||||
}
|
||||
if state != libpod.ContainerStateRunning {
|
||||
if err := runtime.RemoveContainer(ctr, false); err != nil {
|
||||
if err := runtime.RemoveContainer(ctx, ctr, false); err != nil {
|
||||
return call.ReplyErrorOccurred(err.Error())
|
||||
}
|
||||
deletedContainers = append(deletedContainers, ctr.ID())
|
||||
|
Reference in New Issue
Block a user