diff --git a/tuned/utils/global_config.py b/tuned/utils/global_config.py index e0ed4365..1e36f619 100644 --- a/tuned/utils/global_config.py +++ b/tuned/utils/global_config.py @@ -20,8 +20,8 @@ def __init__(self,config_file = consts.GLOBAL_CONFIG_FILE): def get_global_config_spec(): """ Easy validation mimicking configobj - Returns two dicts, first with default values (default None) - global_default[consts.CFG_SOMETHING] = consts.CFG_DEF_SOMETHING or None + Returns two dicts, first with default values (if there is one) + global_default[consts.CFG_SOMETHING] = consts.CFG_DEF_SOMETHING second with configobj function for value type (default "get" for string, others eg getboolean, getint) global_function[consts.CFG_SOMETHING] = consts.CFG_FUNC_SOMETHING or get } @@ -30,7 +30,7 @@ def get_global_config_spec(): if opt.startswith("CFG_") and not opt.startswith("CFG_FUNC_") and not opt.startswith("CFG_DEF_")] - global_default = dict((getattr(consts, opt), getattr(consts, "CFG_DEF_" + opt[4:], None)) for opt in options) + global_default = dict((getattr(consts, opt), getattr(consts, "CFG_DEF_" + opt[4:])) for opt in options if hasattr(consts, "CFG_DEF_" + opt[4:])) global_function = dict((getattr(consts, opt), getattr(consts, "CFG_FUNC_" + opt[4:], "get")) for opt in options) return global_default, global_function