Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
config: Create function to check config options
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
jodh-intel committed Nov 29, 2018
1 parent 70e4dc5 commit fe784c1
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions pkg/katautils/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -659,15 +659,25 @@ func LoadConfiguration(configPath string, ignoreLogging, builtIn bool) (resolved
}

config.DisableNewNetNs = tomlConf.Runtime.DisableNewNetNs
if err := checkNetNsConfig(config); 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 "", config, err
return err
}

return resolved, config, nil
return nil
}

func updateConfig(configPath string, tomlConf tomlConfig, config *oci.RuntimeConfig, builtIn bool) error {
Expand Down

0 comments on commit fe784c1

Please # to comment.