summaryrefslogtreecommitdiff
path: root/cloudinit/sources
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2015-07-31 16:31:26 +0000
committerScott Moser <smoser@ubuntu.com>2015-07-31 16:31:26 +0000
commit4f4e6d1cf90928daa1ab339f687b3319454aefdd (patch)
tree6aa8c6d562eb23d5673e714b9e3f22b934c49283 /cloudinit/sources
parentf36706442b4c1913ea8f7953993b9e03f3adf623 (diff)
downloadvyos-cloud-init-4f4e6d1cf90928daa1ab339f687b3319454aefdd.tar.gz
vyos-cloud-init-4f4e6d1cf90928daa1ab339f687b3319454aefdd.zip
move 'mode' out of SearchReportStack
Diffstat (limited to 'cloudinit/sources')
-rw-r--r--cloudinit/sources/__init__.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/cloudinit/sources/__init__.py b/cloudinit/sources/__init__.py
index 0dc75f9e..6f2d2276 100644
--- a/cloudinit/sources/__init__.py
+++ b/cloudinit/sources/__init__.py
@@ -248,13 +248,12 @@ def normalize_pubkey_data(pubkey_data):
class SearchReportStack(reporting.ReportStack):
- def __init__(self, source, ds_deps, parent):
+ def __init__(self, source, mode, parent):
self.source = source.replace("DataSource", "")
name = "check-%s" % self.source
self.found = False
- self.mode = "network" if DEP_NETWORK in ds_deps else "local"
- description = "searching for %s data from %s" % (
- self.mode, self.source)
+ self.mode = mode
+ description = "searching for %s data from %s" % (mode, self.source)
super(SearchReportStack, self).__init__(
name=name, description=description, parent=parent,
result_on_exception=reporting.status.WARN)
@@ -274,11 +273,12 @@ class SearchReportStack(reporting.ReportStack):
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)
+ mode = "network" if DEP_NETWORK in ds_deps else "local"
+ LOG.debug("Searching for %s data source in: %s", mode, ds_names)
for name, cls in zip(ds_names, ds_list):
try:
- with SearchReportStack(name, ds_deps, reporter) as rep:
+ with SearchReportStack(name, mode, reporter) as rep:
LOG.debug("Seeing if we can get any data from %s", cls)
s = cls(sys_cfg, distro, paths)
if s.get_data():