diff options
author | Joshua Harlow <harlowja@yahoo-inc.com> | 2012-06-22 23:43:48 -0700 |
---|---|---|
committer | Joshua Harlow <harlowja@yahoo-inc.com> | 2012-06-22 23:43:48 -0700 |
commit | a0f42d8f96248d519e70a86e470868616dea3d6e (patch) | |
tree | 6008fbf55e5e77f770d798821a7a90bf9f9a6dcd /cloudinit | |
parent | fdbd341aae7a41d3985e544fe40375087056b1f9 (diff) | |
download | vyos-cloud-init-a0f42d8f96248d519e70a86e470868616dea3d6e.tar.gz vyos-cloud-init-a0f42d8f96248d519e70a86e470868616dea3d6e.zip |
Don't complete the update if there is no datasource or if writing to cache fails
Diffstat (limited to 'cloudinit')
-rw-r--r-- | cloudinit/stages.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/cloudinit/stages.py b/cloudinit/stages.py index cfe1c071..3ed13009 100644 --- a/cloudinit/stages.py +++ b/cloudinit/stages.py @@ -178,10 +178,13 @@ class Init(object): return None def _write_to_cache(self): + if not self.datasource: + return False pickled_fn = self.paths.get_ipath_cur("obj_pkl") try: contents = pickle.dumps(self.datasource) util.write_file(pickled_fn, contents, mode=0400) + return True except Exception: util.logexc(LOG, "Failed pickling datasource to %s", pickled_fn) return False @@ -292,7 +295,8 @@ class Init(object): self.distro, helpers.Runners(self.paths)) def update(self): - self._write_to_cache() + if not self._write_to_cache(): + return self._store_userdata() def _store_userdata(self): |