From e6730fd0f08a77ee943c6f00b8d425b92f186208 Mon Sep 17 00:00:00 2001 From: Evan Lezar Date: Wed, 6 Apr 2022 15:13:32 +0200 Subject: [PATCH] FIX: Don't log that hooks is being removed if it is not Signed-off-by: Evan Lezar --- cmd/nvidia-container-runtime/modifier/hook_remover.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cmd/nvidia-container-runtime/modifier/hook_remover.go b/cmd/nvidia-container-runtime/modifier/hook_remover.go index e8743352..69249730 100644 --- a/cmd/nvidia-container-runtime/modifier/hook_remover.go +++ b/cmd/nvidia-container-runtime/modifier/hook_remover.go @@ -42,12 +42,16 @@ func (m nvidiaContainerRuntimeHookRemover) Modify(spec *specs.Spec) error { return nil } + if len(spec.Hooks.Prestart) == 0 { + return nil + } + var updateRequired bool newPrestart := make([]specs.Hook, 0, len(spec.Hooks.Prestart)) for _, hook := range spec.Hooks.Prestart { if isNVIDIAContainerRuntimeHook(&hook) { - m.logger.Infof("Removing hook %v", hook) + m.logger.Warnf("Found existing NVIDIA Container Runtime Hook: %v", hook) updateRequired = true continue }