diff options
author | Scott Moser <smoser@ubuntu.com> | 2012-11-12 13:40:57 -0500 |
---|---|---|
committer | Scott Moser <smoser@ubuntu.com> | 2012-11-12 13:40:57 -0500 |
commit | fe68049611e12591a632d5264d9ba1b67b0cfa0d (patch) | |
tree | 746046f99619dada9693b5f75c8c70477edb9de5 /cloudinit | |
parent | 5a084e641dea06b440f4a539147254bc775640a9 (diff) | |
download | vyos-cloud-init-fe68049611e12591a632d5264d9ba1b67b0cfa0d.tar.gz vyos-cloud-init-fe68049611e12591a632d5264d9ba1b67b0cfa0d.zip |
stages.py: fix issue that resulted in broken data source searching
This just replaces the portions of stages.py that were checking or
setting self.datasource to a DataSourceNone to use a static/global
datasource. And then, check for None is done against that.
Diffstat (limited to 'cloudinit')
-rw-r--r-- | cloudinit/stages.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/cloudinit/stages.py b/cloudinit/stages.py index e0cf1cbe..9c231994 100644 --- a/cloudinit/stages.py +++ b/cloudinit/stages.py @@ -49,6 +49,7 @@ from cloudinit import util LOG = logging.getLogger(__name__) +NULL_DATA_SOURCE = DataSourceNone.DataSourceNone({}, None, None) class Init(object): def __init__(self, ds_deps=None): @@ -61,7 +62,7 @@ class Init(object): self._paths = None self._distro = None # Changed only when a fetch occurs - self.datasource = DataSourceNone.DataSourceNone({}, None, None) + self.datasource = NULL_DATA_SOURCE def _reset(self, ds=False): # Recreated on access @@ -69,7 +70,7 @@ class Init(object): self._paths = None self._distro = None if ds: - self.datasource = DataSourceNone.DataSourceNone({}, None, None) + self.datasource = NULL_DATA_SOURCE @property def distro(self): @@ -201,7 +202,7 @@ class Init(object): return None def _write_to_cache(self): - if not self.datasource: + if self.datasource is NULL_DATA_SOURCE: return False pickled_fn = self.paths.get_ipath_cur("obj_pkl") try: @@ -227,7 +228,7 @@ class Init(object): return (cfg_list, pkg_list) def _get_data_source(self): - if self.datasource: + if self.datasource is not NULL_DATA_SOURCE: return self.datasource ds = self._restore_from_cache() if ds: |