summaryrefslogtreecommitdiff
path: root/cloudinit
diff options
context:
space:
mode:
authorJoshua Harlow <harlowja@yahoo-inc.com>2012-06-28 15:13:19 -0700
committerJoshua Harlow <harlowja@yahoo-inc.com>2012-06-28 15:13:19 -0700
commitcb7274fa1ded413b0c5a19152ddf6e791aba98cf (patch)
tree03fa3e91a40151eea61f3b4c1ad6549c2dba3e87 /cloudinit
parent1c2c043b970a62f82b5e19e368b348d48ebbb638 (diff)
downloadvyos-cloud-init-cb7274fa1ded413b0c5a19152ddf6e791aba98cf.tar.gz
vyos-cloud-init-cb7274fa1ded413b0c5a19152ddf6e791aba98cf.zip
1. Update with smosers code review and comments (and put some of those comments into the files)
2. Rename consume() to consume_userdata() as it helps in figuring out what this does. 3. Fixup the tests due to #2
Diffstat (limited to 'cloudinit')
-rw-r--r--cloudinit/stages.py19
1 files changed, 9 insertions, 10 deletions
diff --git a/cloudinit/stages.py b/cloudinit/stages.py
index 47f6e188..6689e4c9 100644
--- a/cloudinit/stages.py
+++ b/cloudinit/stages.py
@@ -192,13 +192,13 @@ class Init(object):
cfg_list = self.cfg.get('datasource_list') or []
return (cfg_list, pkg_list)
- def _get_data_source(self, local_only=False):
+ def _get_data_source(self):
if self.datasource:
return self.datasource
ds = self._restore_from_cache()
if ds:
LOG.debug("Restored from cache, datasource: %s", ds)
- if not ds and not local_only:
+ if not ds:
(cfg_list, pkg_list) = self._get_datasources()
# Deep copy so that user-data handlers can not modify
# (which will affect user-data handlers down the line...)
@@ -209,11 +209,10 @@ class Init(object):
cfg_list,
pkg_list)
LOG.debug("Loaded datasource %s - %s", dsname, ds)
- if ds:
- self.datasource = ds
- # Ensure we adjust our path members datasource
- # now that we have one (thus allowing ipath to be used)
- self.paths.datasource = ds
+ self.datasource = ds
+ # Ensure we adjust our path members datasource
+ # now that we have one (thus allowing ipath to be used)
+ self.paths.datasource = ds
return ds
def _get_instance_subdirs(self):
@@ -275,8 +274,8 @@ class Init(object):
"%s\n" % (previous_iid))
return iid
- def fetch(self, local_only=False):
- return self._get_data_source(local_only)
+ def fetch(self):
+ return self._get_data_source()
def instancify(self):
return self._reflect_cur_instance()
@@ -312,7 +311,7 @@ class Init(object):
]
return def_handlers
- def consume(self, frequency=PER_INSTANCE):
+ def consume_userdata(self, frequency=PER_INSTANCE):
cdir = self.paths.get_cpath("handlers")
idir = self._get_ipath("handlers")