~harlowja/cloud-init/query-back-duo

« back to all changes in this revision

Viewing changes to cloudinit/stages.py

  • Committer: Joshua Harlow
  • Date: 2012-12-24 04:29:22 UTC
  • Revision ID: harlowja@gmail.com-20121224042922-4niyrmyakp62w0ed
Integrate a slightly cleaner query tool, bring it back to life!

Show diffs side-by-side

added added

removed removed

Lines of Context:
217
217
        cfg_list = self.cfg.get('datasource_list') or []
218
218
        return (cfg_list, pkg_list)
219
219
 
220
 
    def _get_data_source(self):
 
220
    def _get_data_source(self, local_only):
221
221
        if self.datasource is not NULL_DATA_SOURCE:
222
222
            return self.datasource
223
223
        ds = self._restore_from_cache()
224
224
        if ds:
225
225
            LOG.debug("Restored from cache, datasource: %s", ds)
226
 
        if not ds:
 
226
        # Try to find one that will work
 
227
        if not ds and not local_only:
227
228
            (cfg_list, pkg_list) = self._get_datasources()
228
229
            # Deep copy so that user-data handlers can not modify
229
230
            # (which will affect user-data handlers down the line...)
303
304
        self._reset()
304
305
        return iid
305
306
 
306
 
    def fetch(self):
307
 
        return self._get_data_source()
 
307
    def fetch(self, local_only=False):
 
308
        return self._get_data_source(local_only)
308
309
 
309
310
    def instancify(self):
310
311
        return self._reflect_cur_instance()