mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-03 18:47:03 +00:00
config: Create function to check config options
Moved the checking routines in `LoadConfiguration()` to a new `checkConfig()` function for clarity. Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
This commit is contained in:
parent
70e4dc550a
commit
fe784c1e36
@ -659,17 +659,27 @@ func LoadConfiguration(configPath string, ignoreLogging, builtIn bool) (resolved
|
||||
}
|
||||
|
||||
config.DisableNewNetNs = tomlConf.Runtime.DisableNewNetNs
|
||||
if err := checkNetNsConfig(config); err != nil {
|
||||
return "", config, err
|
||||
}
|
||||
|
||||
if err := checkHypervisorConfig(config.HypervisorConfig); err != nil {
|
||||
if err := checkConfig(config); err != nil {
|
||||
return "", config, err
|
||||
}
|
||||
|
||||
return resolved, config, nil
|
||||
}
|
||||
|
||||
// checkConfig checks the validity of the specified config.
|
||||
func checkConfig(config oci.RuntimeConfig) error {
|
||||
if err := checkNetNsConfig(config); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := checkHypervisorConfig(config.HypervisorConfig); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func updateConfig(configPath string, tomlConf tomlConfig, config *oci.RuntimeConfig, builtIn bool) error {
|
||||
|
||||
if err := updateRuntimeConfig(configPath, tomlConf, config); err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user