summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cloudinit/CloudConfig/__init__.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/cloudinit/CloudConfig/__init__.py b/cloudinit/CloudConfig/__init__.py
index c0d8928c..874f8d0a 100644
--- a/cloudinit/CloudConfig/__init__.py
+++ b/cloudinit/CloudConfig/__init__.py
@@ -35,9 +35,12 @@ class CloudConfig():
self.cloud.get_data_source()
def get_config_obj(self,cfgfile):
- f=file(cfgfile)
- cfg=yaml.load(f.read())
- f.close()
+ try:
+ cfg = util.read_conf(cfgfile)
+ except:
+ cloudinit.log.critical("Failed loading of cloud config '%s'. Continuing with empty config %s\n" % cfgfile)
+ cloudinit.log.debug(traceback.format_exc() + "\n")
+ cfg = None
if cfg is None: cfg = { }
return(util.mergedict(cfg,self.cloud.cfg))