[TOML ConfigSource] add support for executing fallback CLI commands

Signed-off-by: Tariq Ibrahim <tibrahim@nvidia.com>
Co-authored-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
Tariq Ibrahim
2024-10-22 18:20:52 -07:00
parent 3c07ea0b17
commit 0f7aba9c3c
4 changed files with 50 additions and 8 deletions

View File

@@ -128,8 +128,7 @@ func (c *Config) GetRuntimeConfig(name string) (engine.RuntimeConfig, error) {
// CommandLineSource returns the CLI-based containerd config loader
func CommandLineSource(hostRoot string) toml.Loader {
commandLine := chrootIfRequired(hostRoot, "containerd", "config", "dump")
return toml.FromCommandLine(commandLine[0], commandLine[1:]...)
return toml.FromCommandLine(chrootIfRequired(hostRoot, "containerd", "config", "dump")...)
}
func chrootIfRequired(hostRoot string, commandLine ...string) []string {