summaryrefslogtreecommitdiff
path: root/cloudinit/sources
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2015-07-30 18:06:01 -0400
committerScott Moser <smoser@ubuntu.com>2015-07-30 18:06:01 -0400
commitb5574a9925b29417a1b351e7b38c54bc7d144dba (patch)
treeffb5e9ce10b5832e6a5f41df5e5dc02b127729d0 /cloudinit/sources
parentc33b3becebfa7bf3f6e2ee67ea7bc3def6feeb8c (diff)
downloadvyos-cloud-init-b5574a9925b29417a1b351e7b38c54bc7d144dba.tar.gz
vyos-cloud-init-b5574a9925b29417a1b351e7b38c54bc7d144dba.zip
tests pass
Diffstat (limited to 'cloudinit/sources')
-rw-r--r--cloudinit/sources/__init__.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/cloudinit/sources/__init__.py b/cloudinit/sources/__init__.py
index a21c08c2..c4848d5d 100644
--- a/cloudinit/sources/__init__.py
+++ b/cloudinit/sources/__init__.py
@@ -27,6 +27,7 @@ import six
from cloudinit import importer
from cloudinit import log as logging
+from cloudinit import reporting
from cloudinit import type_utils
from cloudinit import user_data as ud
from cloudinit import util
@@ -246,17 +247,22 @@ def normalize_pubkey_data(pubkey_data):
return keys
-def find_source(sys_cfg, distro, paths, ds_deps, cfg_list, pkg_list):
+def find_source(sys_cfg, distro, paths, ds_deps, cfg_list, pkg_list, reporter):
ds_list = list_sources(cfg_list, ds_deps, pkg_list)
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:
+ myreporter = reporting.ReportStack(
+ "check-%s" % cls, "searching for %s" % cls,
+ parent=reporter, exc_result=reporting.status.WARN)
+
try:
- LOG.debug("Seeing if we can get any data from %s", cls)
- s = cls(sys_cfg, distro, paths)
- if s.get_data():
- return (s, type_utils.obj_name(cls))
+ with myreporter:
+ LOG.debug("Seeing if we can get any data from %s", cls)
+ s = cls(sys_cfg, distro, paths)
+ if s.get_data():
+ return (s, type_utils.obj_name(cls))
except Exception:
util.logexc(LOG, "Getting data from %s failed", cls)