remove use of cloudinit constants from util.py in get_base_cfg
use get_base_cfg from CloudInit:read_cfg
This commit is contained in:
parent
52302e59f4
commit
ab8741ef16
@ -123,7 +123,7 @@ log = logging.getLogger(logger_name)
|
||||
log.addHandler(NullHandler())
|
||||
|
||||
def logging_set_from_cfg_file(cfg_file=system_config):
|
||||
logging_set_from_cfg(util.get_base_cfg(cfg_file))
|
||||
logging_set_from_cfg(util.get_base_cfg(cfg_file,cfg_builtin))
|
||||
|
||||
def logging_set_from_cfg(cfg, logfile=None):
|
||||
if logfile is None:
|
||||
@ -181,15 +181,7 @@ class CloudInit:
|
||||
if self.cfg:
|
||||
return(self.cfg)
|
||||
|
||||
conf = { }
|
||||
try:
|
||||
stream = file(self.sysconfig)
|
||||
conf = yaml.load(stream)
|
||||
stream.close()
|
||||
except:
|
||||
pass
|
||||
|
||||
if conf is None: conf = { }
|
||||
conf = util.get_base_cfg(system_config,cfg_builtin)
|
||||
|
||||
# support reading the old ConfigObj format file and merging
|
||||
# it into the yaml dictionary
|
||||
@ -201,9 +193,6 @@ class CloudInit:
|
||||
except:
|
||||
pass
|
||||
|
||||
if not conf.has_key("cloud_type"):
|
||||
conf["cloud_type"]=None
|
||||
|
||||
return(conf)
|
||||
|
||||
def restore_from_cache(self):
|
||||
|
@ -33,9 +33,12 @@ def read_conf(fname):
|
||||
return { }
|
||||
raise
|
||||
|
||||
def get_base_cfg(cfgfile=cloudinit.system_config):
|
||||
def get_base_cfg(cfgfile,cfg_builtin=""):
|
||||
syscfg = read_conf(cfgfile)
|
||||
builtin = yaml.load(cloudinit.cfg_builtin)
|
||||
if cfg_builtin:
|
||||
builtin = yaml.load(cfg_builtin)
|
||||
else:
|
||||
return(syscfg)
|
||||
return(mergedict(syscfg,builtin))
|
||||
|
||||
def get_cfg_option_bool(yobj, key, default=False):
|
||||
|
Loading…
x
Reference in New Issue
Block a user