mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2025-04-10 15:25:33 +00:00
Merge branch 'debug-no-cgroups' into 'main'
Add required option to new toml config See merge request nvidia/container-toolkit/container-toolkit!476
This commit is contained in:
commit
89240cecae
@ -1,5 +1,9 @@
|
|||||||
# NVIDIA Container Toolkit Changelog
|
# NVIDIA Container Toolkit Changelog
|
||||||
|
|
||||||
|
## v1.14.1
|
||||||
|
* Use libelf.so on RPM-based systems due to removed mageia repositories hosting pmake and bmake.
|
||||||
|
* Fixed bug where contents of `/etc/nvidia-container-runtime/config.toml` is ignored by the NVIDIA Container Runtime Hook.
|
||||||
|
|
||||||
## v1.14.0
|
## v1.14.0
|
||||||
* Promote v1.14.0-rc.3 to v1.14.0
|
* Promote v1.14.0-rc.3 to v1.14.0
|
||||||
|
|
||||||
|
@ -45,6 +45,7 @@ func loadConfig() (*config.Config, error) {
|
|||||||
for _, p := range configPaths {
|
for _, p := range configPaths {
|
||||||
cfg, err := config.New(
|
cfg, err := config.New(
|
||||||
config.WithConfigFile(p),
|
config.WithConfigFile(p),
|
||||||
|
config.WithRequired(true),
|
||||||
)
|
)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
return cfg.Config()
|
return cfg.Config()
|
||||||
|
@ -31,6 +31,7 @@ type Toml toml.Tree
|
|||||||
|
|
||||||
type options struct {
|
type options struct {
|
||||||
configFile string
|
configFile string
|
||||||
|
required bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// Option is a functional option for loading TOML config files.
|
// Option is a functional option for loading TOML config files.
|
||||||
@ -43,6 +44,14 @@ func WithConfigFile(configFile string) Option {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WithRequired sets the required option.
|
||||||
|
// If this is set to true, a failure to open the specified file is treated as an error
|
||||||
|
func WithRequired(required bool) Option {
|
||||||
|
return func(o *options) {
|
||||||
|
o.required = required
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// New creates a new toml tree based on the provided options
|
// New creates a new toml tree based on the provided options
|
||||||
func New(opts ...Option) (*Toml, error) {
|
func New(opts ...Option) (*Toml, error) {
|
||||||
o := &options{}
|
o := &options{}
|
||||||
@ -50,19 +59,25 @@ func New(opts ...Option) (*Toml, error) {
|
|||||||
opt(o)
|
opt(o)
|
||||||
}
|
}
|
||||||
|
|
||||||
return loadConfigToml(o.configFile)
|
return o.loadConfigToml()
|
||||||
}
|
}
|
||||||
|
|
||||||
func loadConfigToml(filename string) (*Toml, error) {
|
func (o options) loadConfigToml() (*Toml, error) {
|
||||||
|
filename := o.configFile
|
||||||
if filename == "" {
|
if filename == "" {
|
||||||
return defaultToml()
|
return defaultToml()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_, err := os.Stat(filename)
|
||||||
|
if os.IsNotExist(err) && o.required {
|
||||||
|
return nil, os.ErrNotExist
|
||||||
|
}
|
||||||
|
|
||||||
tomlFile, err := os.Open(filename)
|
tomlFile, err := os.Open(filename)
|
||||||
if os.IsNotExist(err) {
|
if os.IsNotExist(err) {
|
||||||
return defaultToml()
|
return defaultToml()
|
||||||
} else if err != nil {
|
} else if err != nil {
|
||||||
return nil, fmt.Errorf("failed to load specified config file: %v", err)
|
return nil, fmt.Errorf("failed to load specified config file: %w", err)
|
||||||
}
|
}
|
||||||
defer tomlFile.Close()
|
defer tomlFile.Close()
|
||||||
|
|
||||||
|
2
third_party/libnvidia-container
vendored
2
third_party/libnvidia-container
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 6a24508dff6cb36841114ff4c1287cd29ded72af
|
Subproject commit 86b6e51145f2a53257658682b7ae8e24f39e6649
|
@ -13,7 +13,7 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
LIB_NAME := nvidia-container-toolkit
|
LIB_NAME := nvidia-container-toolkit
|
||||||
LIB_VERSION := 1.14.0
|
LIB_VERSION := 1.14.1
|
||||||
LIB_TAG :=
|
LIB_TAG :=
|
||||||
|
|
||||||
# The package version is the combination of the library version and tag.
|
# The package version is the combination of the library version and tag.
|
||||||
|
Loading…
Reference in New Issue
Block a user