FIX: Rename CLIConfig to ContainerCLIConfig

Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
Evan Lezar 2022-04-06 15:21:57 +02:00
parent 11aa1d2a7d
commit 0054481e15
3 changed files with 15 additions and 15 deletions

View File

@ -20,14 +20,14 @@ import (
"github.com/pelletier/go-toml"
)
// CLIConfig stores the options for the nvidia-container-cli
type CLIConfig struct {
// ContainerCLIConfig stores the options for the nvidia-container-cli
type ContainerCLIConfig struct {
Root string
}
// getCLIConfigFrom reads the nvidia container runtime config from the specified toml Tree.
func getCLIConfigFrom(toml *toml.Tree) *CLIConfig {
cfg := getDefaultCLIConfig()
// getContainerCLIConfigFrom reads the nvidia container runtime config from the specified toml Tree.
func getContainerCLIConfigFrom(toml *toml.Tree) *ContainerCLIConfig {
cfg := getDefaultContainerCLIConfig()
if toml == nil {
return cfg
@ -38,9 +38,9 @@ func getCLIConfigFrom(toml *toml.Tree) *CLIConfig {
return cfg
}
// getDefaultCLIConfig defines the default values for the config
func getDefaultCLIConfig() *CLIConfig {
c := CLIConfig{
// getDefaultContainerCLIConfig defines the default values for the config
func getDefaultContainerCLIConfig() *ContainerCLIConfig {
c := ContainerCLIConfig{
Root: "",
}

View File

@ -37,8 +37,8 @@ var (
// 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
type Config struct {
NVIDIAContainerCLIConfig CLIConfig `toml:"nvidia-container-cli"`
NVIDIAContainerRuntimeConfig RuntimeConfig `toml:"nvidia-container-runtime"`
NVIDIAContainerCLIConfig ContainerCLIConfig `toml:"nvidia-container-cli"`
NVIDIAContainerRuntimeConfig RuntimeConfig `toml:"nvidia-container-runtime"`
}
// GetConfig sets up the config struct. Values are read from a toml file
@ -82,7 +82,7 @@ func getConfigFrom(toml *toml.Tree) *Config {
return cfg
}
cfg.NVIDIAContainerCLIConfig = *getCLIConfigFrom(toml)
cfg.NVIDIAContainerCLIConfig = *getContainerCLIConfigFrom(toml)
cfg.NVIDIAContainerRuntimeConfig = *getRuntimeConfigFrom(toml)
return cfg
@ -91,7 +91,7 @@ func getConfigFrom(toml *toml.Tree) *Config {
// getDefaultConfig defines the default values for the config
func getDefaultConfig() *Config {
c := Config{
NVIDIAContainerCLIConfig: *getDefaultCLIConfig(),
NVIDIAContainerCLIConfig: *getDefaultContainerCLIConfig(),
NVIDIAContainerRuntimeConfig: *getDefaultRuntimeConfig(),
}

View File

@ -57,7 +57,7 @@ func TestGetConfig(t *testing.T) {
{
description: "empty config is default",
expectedConfig: &Config{
NVIDIAContainerCLIConfig: CLIConfig{
NVIDIAContainerCLIConfig: ContainerCLIConfig{
Root: "",
},
NVIDIAContainerRuntimeConfig: RuntimeConfig{
@ -75,7 +75,7 @@ func TestGetConfig(t *testing.T) {
"nvidia-container-runtime.discover-mode = \"not-legacy\"",
},
expectedConfig: &Config{
NVIDIAContainerCLIConfig: CLIConfig{
NVIDIAContainerCLIConfig: ContainerCLIConfig{
Root: "",
},
NVIDIAContainerRuntimeConfig: RuntimeConfig{
@ -94,7 +94,7 @@ func TestGetConfig(t *testing.T) {
"discover-mode = \"not-legacy\"",
},
expectedConfig: &Config{
NVIDIAContainerCLIConfig: CLIConfig{
NVIDIAContainerCLIConfig: ContainerCLIConfig{
Root: "",
},
NVIDIAContainerRuntimeConfig: RuntimeConfig{