shimv2: log a warning and continue on post-stop hook failure

According to runtime-spec:
The poststop hooks MUST be invoked by the runtime. If any
poststop hook fails, the runtime MUST log a warning, but
the remaining hooks and lifecycle continue as if the hook
had succeeded.

Fixes: #1252

Signed-off-by: Snir Sheriber <ssheribe@redhat.com>
This commit is contained in:
Snir Sheriber 2021-01-13 14:52:15 +02:00
parent 4de21e3d95
commit e7043fe284

View File

@ -29,7 +29,9 @@ func deleteContainer(ctx context.Context, s *service, c *container) error {
// Run post-stop OCI hooks. // Run post-stop OCI hooks.
if err := katautils.PostStopHooks(ctx, *c.spec, s.sandbox.ID(), c.bundle); err != nil { if err := katautils.PostStopHooks(ctx, *c.spec, s.sandbox.ID(), c.bundle); err != nil {
return err // log warning and continue, as defined in oci runtime spec
// https://github.com/opencontainers/runtime-spec/blob/master/runtime.md#lifecycle
shimLog.WithError(err).Warn("Failed to run post-stop hooks")
} }
if c.mounted { if c.mounted {