summaryrefslogtreecommitdiff
path: root/cloudinit
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2015-07-31 14:38:09 +0000
committerScott Moser <smoser@ubuntu.com>2015-07-31 14:38:09 +0000
commitb22302d8e2b539f61faede7efb3a163966bf170a (patch)
treeb847791cea471ebf31a870926c1c8a21888757c3 /cloudinit
parent6f174b41496f133af92fb373f3b718eabdebfa05 (diff)
downloadvyos-cloud-init-b22302d8e2b539f61faede7efb3a163966bf170a.tar.gz
vyos-cloud-init-b22302d8e2b539f61faede7efb3a163966bf170a.zip
fix issues found when testing
Diffstat (limited to 'cloudinit')
-rw-r--r--cloudinit/reporting.py16
-rw-r--r--cloudinit/sources/__init__.py5
2 files changed, 13 insertions, 8 deletions
diff --git a/cloudinit/reporting.py b/cloudinit/reporting.py
index c925f661..1bd7df0d 100644
--- a/cloudinit/reporting.py
+++ b/cloudinit/reporting.py
@@ -137,7 +137,6 @@ class ReportStack(object):
def __init__(self, name, description, parent=None, reporting=None,
exc_result=None):
self.parent = parent
- self.reporting = reporting
self.name = name
self.description = description
@@ -145,18 +144,23 @@ class ReportStack(object):
exc_result = status.FAIL
self.exc_result = exc_result
+ # use parents reporting value if not provided
if reporting is None:
- # if reporting is specified respect it, otherwise use parent's value
if parent:
reporting = parent.reporting
else:
reporting = True
+ self.reporting = reporting
+
if parent:
- self.fullname = '/'.join((name, parent.fullname,))
+ self.fullname = '/'.join((parent.fullname, name,))
else:
self.fullname = self.name
self.children = {}
+ def __repr__(self):
+ return ("%s reporting=%s" % (self.fullname, self.reporting))
+
def __enter__(self):
self.exception = None
if self.reporting:
@@ -166,10 +170,10 @@ class ReportStack(object):
return self
def childrens_finish_info(self, result=None, description=None):
- for result in (status.FAIL, status.WARN):
+ for cand_result in (status.FAIL, status.WARN):
for name, (value, msg) in self.children.items():
- if value == result:
- return (result, "[" + name + "]" + msg)
+ if value == cand_result:
+ return (value, "[" + name + "]" + msg)
if result is None:
result = status.SUCCESS
if description is None:
diff --git a/cloudinit/sources/__init__.py b/cloudinit/sources/__init__.py
index c4848d5d..f585c3e4 100644
--- a/cloudinit/sources/__init__.py
+++ b/cloudinit/sources/__init__.py
@@ -252,9 +252,10 @@ def find_source(sys_cfg, distro, paths, ds_deps, cfg_list, pkg_list, reporter):
ds_names = [type_utils.obj_name(f) for f in ds_list]
LOG.debug("Searching for data source in: %s", ds_names)
- for cls in ds_list:
+ for i, cls in enumerate(ds_list):
+ name=ds_names[i].replace("DataSource", "")
myreporter = reporting.ReportStack(
- "check-%s" % cls, "searching for %s" % cls,
+ "check-%s" % name, "searching for %s" % name,
parent=reporter, exc_result=reporting.status.WARN)
try: