mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2025-02-19 18:58:34 +00:00
FIX: Make isNVIDIAContainerRuntimeHook mode idiomatic
Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
parent
b8dd473343
commit
9ce690093d
@ -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
|
// or nvidia-container-toolkit hook. These are included, for example, by the non-experimental
|
||||||
// nvidia-container-runtime or docker when specifying the --gpus flag.
|
// nvidia-container-runtime or docker when specifying the --gpus flag.
|
||||||
func isNVIDIAContainerRuntimeHook(hook *specs.Hook) bool {
|
func isNVIDIAContainerRuntimeHook(hook *specs.Hook) bool {
|
||||||
lookFor := map[string]bool{
|
bins := map[string]struct{}{
|
||||||
nvidiaContainerRuntimeHookExecutable: true,
|
nvidiaContainerRuntimeHookExecutable: {},
|
||||||
nvidiaContainerToolkitExecutable: true,
|
nvidiaContainerToolkitExecutable: {},
|
||||||
}
|
}
|
||||||
base := filepath.Base(hook.Path)
|
|
||||||
|
|
||||||
return lookFor[base]
|
_, exists := bins[filepath.Base(hook.Path)]
|
||||||
|
|
||||||
|
return exists
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user