Fix overwriting docker feature flags

Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
Evan Lezar 2025-01-27 15:37:06 +01:00
parent e89be14c86
commit 2b417c1a9a
No known key found for this signature in database

View File

@ -105,7 +105,20 @@ func (c Config) DefaultRuntime() string {
// EnableCDI sets features.cdi to true in the docker config. // EnableCDI sets features.cdi to true in the docker config.
func (c *Config) EnableCDI() { func (c *Config) EnableCDI() {
(*c)["features"] = map[string]bool{"cdi": true} if c == nil {
return
}
config := *c
features, ok := config["features"].(map[string]bool)
if !ok {
features = make(map[string]bool)
}
features["cdi"] = true
config["features"] = features
*c = config
} }
// RemoveRuntime removes a runtime from the docker config // RemoveRuntime removes a runtime from the docker config