FIX: Make isNVIDIAContainerRuntimeHook mode idiomatic

Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
Evan Lezar 2022-04-06 17:18:06 +02:00
parent b8dd473343
commit 9ce690093d

View File

@ -59,11 +59,12 @@ func (m nvidiaContainerRuntimeHookRemover) Modify(spec *specs.Spec) error {
// or nvidia-container-toolkit hook. These are included, for example, by the non-experimental
// nvidia-container-runtime or docker when specifying the --gpus flag.
func isNVIDIAContainerRuntimeHook(hook *specs.Hook) bool {
lookFor := map[string]bool{
nvidiaContainerRuntimeHookExecutable: true,
nvidiaContainerToolkitExecutable: true,
bins := map[string]struct{}{
nvidiaContainerRuntimeHookExecutable: {},
nvidiaContainerToolkitExecutable: {},
}
base := filepath.Base(hook.Path)
return lookFor[base]
_, exists := bins[filepath.Base(hook.Path)]
return exists
}