mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2025-06-26 18:18:24 +00:00
Remove discover.Config
These changes remove the use of discover.Config which was used to pass the driver root and the nvidiaCTK path in some cases. Instead, the nvidiaCTKPath is resolved at the begining of runtime invocation to ensure that this is valid at all points where it is used. Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
@@ -22,6 +22,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/NVIDIA/nvidia-container-toolkit/internal/config"
|
||||
"github.com/NVIDIA/nvidia-container-toolkit/internal/discover"
|
||||
"github.com/NVIDIA/nvidia-container-toolkit/internal/info"
|
||||
"github.com/opencontainers/runtime-spec/specs-go"
|
||||
)
|
||||
@@ -44,10 +45,6 @@ func (r rt) Run(argv []string) (rerr error) {
|
||||
if err != nil {
|
||||
return fmt.Errorf("error loading config: %v", err)
|
||||
}
|
||||
if r.modeOverride != "" {
|
||||
cfg.NVIDIAContainerRuntimeConfig.Mode = r.modeOverride
|
||||
}
|
||||
|
||||
err = r.logger.Update(
|
||||
cfg.NVIDIAContainerRuntimeConfig.DebugFilePath,
|
||||
cfg.NVIDIAContainerRuntimeConfig.LogLevel,
|
||||
@@ -63,6 +60,13 @@ func (r rt) Run(argv []string) (rerr error) {
|
||||
r.logger.Reset()
|
||||
}()
|
||||
|
||||
// We apply some config updates here to ensure that the config is valid in
|
||||
// all cases.
|
||||
if r.modeOverride != "" {
|
||||
cfg.NVIDIAContainerRuntimeConfig.Mode = r.modeOverride
|
||||
}
|
||||
cfg.NVIDIACTKConfig.Path = discover.FindNvidiaCTK(r.logger.Logger, cfg.NVIDIACTKConfig.Path)
|
||||
|
||||
// Print the config to the output.
|
||||
configJSON, err := json.MarshalIndent(cfg, "", " ")
|
||||
if err == nil {
|
||||
|
||||
Reference in New Issue
Block a user