From fe784c1e36669eb64eeeb5ae662cffb1d983b75f Mon Sep 17 00:00:00 2001 From: "James O. D. Hunt" Date: Thu, 29 Nov 2018 08:28:14 +0000 Subject: [PATCH] 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 --- pkg/katautils/config.go | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/pkg/katautils/config.go b/pkg/katautils/config.go index 0b2c57dba6..7d333caba8 100644 --- a/pkg/katautils/config.go +++ b/pkg/katautils/config.go @@ -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 {