summaryrefslogtreecommitdiff
path: root/cloudinit/reporting.py
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/reporting.py
parent6f174b41496f133af92fb373f3b718eabdebfa05 (diff)
downloadvyos-cloud-init-b22302d8e2b539f61faede7efb3a163966bf170a.tar.gz
vyos-cloud-init-b22302d8e2b539f61faede7efb3a163966bf170a.zip
fix issues found when testing
Diffstat (limited to 'cloudinit/reporting.py')
-rw-r--r--cloudinit/reporting.py16
1 files changed, 10 insertions, 6 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: