mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2025-03-10 14:22:11 +00:00
Reuse check for existing hook
This change reuse the code that checks for the existing NVIDIA Container Runtime hook to ensure that both nvidia-container-toolkit and nvidia-container-runtime-hook are detected. Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
parent
6ed3a4e1a6
commit
87afcc3ef4
@ -20,7 +20,6 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/NVIDIA/nvidia-container-toolkit/internal/config"
|
"github.com/NVIDIA/nvidia-container-toolkit/internal/config"
|
||||||
"github.com/NVIDIA/nvidia-container-toolkit/internal/oci"
|
"github.com/NVIDIA/nvidia-container-toolkit/internal/oci"
|
||||||
@ -61,8 +60,8 @@ func (m stableRuntimeModifier) Modify(spec *specs.Spec) error {
|
|||||||
spec.Hooks = &specs.Hooks{}
|
spec.Hooks = &specs.Hooks{}
|
||||||
} else if len(spec.Hooks.Prestart) != 0 {
|
} else if len(spec.Hooks.Prestart) != 0 {
|
||||||
for _, hook := range spec.Hooks.Prestart {
|
for _, hook := range spec.Hooks.Prestart {
|
||||||
if strings.Contains(hook.Path, config.NVIDIAContainerRuntimeHookExecutable) {
|
if isNVIDIAContainerRuntimeHook(&hook) {
|
||||||
m.logger.Infof("existing nvidia prestart hook found in OCI spec")
|
m.logger.Infof("Existing nvidia prestart hook (%v) found in OCI spec", hook.Path)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user