FIX: Don't log that hooks is being removed if it is not

Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
Evan Lezar 2022-04-06 15:13:32 +02:00
parent 8db287af8b
commit e6730fd0f0

View File

@ -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
}