mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2025-06-08 15:47:32 +00:00
FIX: Rename CLIConfig to ContainerCLIConfig
Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
parent
11aa1d2a7d
commit
0054481e15
@ -20,14 +20,14 @@ import (
|
|||||||
"github.com/pelletier/go-toml"
|
"github.com/pelletier/go-toml"
|
||||||
)
|
)
|
||||||
|
|
||||||
// CLIConfig stores the options for the nvidia-container-cli
|
// ContainerCLIConfig stores the options for the nvidia-container-cli
|
||||||
type CLIConfig struct {
|
type ContainerCLIConfig struct {
|
||||||
Root string
|
Root string
|
||||||
}
|
}
|
||||||
|
|
||||||
// getCLIConfigFrom reads the nvidia container runtime config from the specified toml Tree.
|
// getContainerCLIConfigFrom reads the nvidia container runtime config from the specified toml Tree.
|
||||||
func getCLIConfigFrom(toml *toml.Tree) *CLIConfig {
|
func getContainerCLIConfigFrom(toml *toml.Tree) *ContainerCLIConfig {
|
||||||
cfg := getDefaultCLIConfig()
|
cfg := getDefaultContainerCLIConfig()
|
||||||
|
|
||||||
if toml == nil {
|
if toml == nil {
|
||||||
return cfg
|
return cfg
|
||||||
@ -38,9 +38,9 @@ func getCLIConfigFrom(toml *toml.Tree) *CLIConfig {
|
|||||||
return cfg
|
return cfg
|
||||||
}
|
}
|
||||||
|
|
||||||
// getDefaultCLIConfig defines the default values for the config
|
// getDefaultContainerCLIConfig defines the default values for the config
|
||||||
func getDefaultCLIConfig() *CLIConfig {
|
func getDefaultContainerCLIConfig() *ContainerCLIConfig {
|
||||||
c := CLIConfig{
|
c := ContainerCLIConfig{
|
||||||
Root: "",
|
Root: "",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ var (
|
|||||||
// Config represents the contents of the config.toml file for the NVIDIA Container Toolkit
|
// Config represents the contents of the config.toml file for the NVIDIA Container Toolkit
|
||||||
// Note: This is currently duplicated by the HookConfig in cmd/nvidia-container-toolkit/hook_config.go
|
// Note: This is currently duplicated by the HookConfig in cmd/nvidia-container-toolkit/hook_config.go
|
||||||
type Config struct {
|
type Config struct {
|
||||||
NVIDIAContainerCLIConfig CLIConfig `toml:"nvidia-container-cli"`
|
NVIDIAContainerCLIConfig ContainerCLIConfig `toml:"nvidia-container-cli"`
|
||||||
NVIDIAContainerRuntimeConfig RuntimeConfig `toml:"nvidia-container-runtime"`
|
NVIDIAContainerRuntimeConfig RuntimeConfig `toml:"nvidia-container-runtime"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,7 +82,7 @@ func getConfigFrom(toml *toml.Tree) *Config {
|
|||||||
return cfg
|
return cfg
|
||||||
}
|
}
|
||||||
|
|
||||||
cfg.NVIDIAContainerCLIConfig = *getCLIConfigFrom(toml)
|
cfg.NVIDIAContainerCLIConfig = *getContainerCLIConfigFrom(toml)
|
||||||
cfg.NVIDIAContainerRuntimeConfig = *getRuntimeConfigFrom(toml)
|
cfg.NVIDIAContainerRuntimeConfig = *getRuntimeConfigFrom(toml)
|
||||||
|
|
||||||
return cfg
|
return cfg
|
||||||
@ -91,7 +91,7 @@ func getConfigFrom(toml *toml.Tree) *Config {
|
|||||||
// getDefaultConfig defines the default values for the config
|
// getDefaultConfig defines the default values for the config
|
||||||
func getDefaultConfig() *Config {
|
func getDefaultConfig() *Config {
|
||||||
c := Config{
|
c := Config{
|
||||||
NVIDIAContainerCLIConfig: *getDefaultCLIConfig(),
|
NVIDIAContainerCLIConfig: *getDefaultContainerCLIConfig(),
|
||||||
NVIDIAContainerRuntimeConfig: *getDefaultRuntimeConfig(),
|
NVIDIAContainerRuntimeConfig: *getDefaultRuntimeConfig(),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ func TestGetConfig(t *testing.T) {
|
|||||||
{
|
{
|
||||||
description: "empty config is default",
|
description: "empty config is default",
|
||||||
expectedConfig: &Config{
|
expectedConfig: &Config{
|
||||||
NVIDIAContainerCLIConfig: CLIConfig{
|
NVIDIAContainerCLIConfig: ContainerCLIConfig{
|
||||||
Root: "",
|
Root: "",
|
||||||
},
|
},
|
||||||
NVIDIAContainerRuntimeConfig: RuntimeConfig{
|
NVIDIAContainerRuntimeConfig: RuntimeConfig{
|
||||||
@ -75,7 +75,7 @@ func TestGetConfig(t *testing.T) {
|
|||||||
"nvidia-container-runtime.discover-mode = \"not-legacy\"",
|
"nvidia-container-runtime.discover-mode = \"not-legacy\"",
|
||||||
},
|
},
|
||||||
expectedConfig: &Config{
|
expectedConfig: &Config{
|
||||||
NVIDIAContainerCLIConfig: CLIConfig{
|
NVIDIAContainerCLIConfig: ContainerCLIConfig{
|
||||||
Root: "",
|
Root: "",
|
||||||
},
|
},
|
||||||
NVIDIAContainerRuntimeConfig: RuntimeConfig{
|
NVIDIAContainerRuntimeConfig: RuntimeConfig{
|
||||||
@ -94,7 +94,7 @@ func TestGetConfig(t *testing.T) {
|
|||||||
"discover-mode = \"not-legacy\"",
|
"discover-mode = \"not-legacy\"",
|
||||||
},
|
},
|
||||||
expectedConfig: &Config{
|
expectedConfig: &Config{
|
||||||
NVIDIAContainerCLIConfig: CLIConfig{
|
NVIDIAContainerCLIConfig: ContainerCLIConfig{
|
||||||
Root: "",
|
Root: "",
|
||||||
},
|
},
|
||||||
NVIDIAContainerRuntimeConfig: RuntimeConfig{
|
NVIDIAContainerRuntimeConfig: RuntimeConfig{
|
||||||
|
Loading…
Reference in New Issue
Block a user