Don't complete the update if there is no datasource or if writing to cache fails
This commit is contained in:
parent
46baea3ead
commit
e06021a61b
@ -178,10 +178,13 @@ class Init(object):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
def _write_to_cache(self):
|
def _write_to_cache(self):
|
||||||
|
if not self.datasource:
|
||||||
|
return False
|
||||||
pickled_fn = self.paths.get_ipath_cur("obj_pkl")
|
pickled_fn = self.paths.get_ipath_cur("obj_pkl")
|
||||||
try:
|
try:
|
||||||
contents = pickle.dumps(self.datasource)
|
contents = pickle.dumps(self.datasource)
|
||||||
util.write_file(pickled_fn, contents, mode=0400)
|
util.write_file(pickled_fn, contents, mode=0400)
|
||||||
|
return True
|
||||||
except Exception:
|
except Exception:
|
||||||
util.logexc(LOG, "Failed pickling datasource to %s", pickled_fn)
|
util.logexc(LOG, "Failed pickling datasource to %s", pickled_fn)
|
||||||
return False
|
return False
|
||||||
@ -292,7 +295,8 @@ class Init(object):
|
|||||||
self.distro, helpers.Runners(self.paths))
|
self.distro, helpers.Runners(self.paths))
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
self._write_to_cache()
|
if not self._write_to_cache():
|
||||||
|
return
|
||||||
self._store_userdata()
|
self._store_userdata()
|
||||||
|
|
||||||
def _store_userdata(self):
|
def _store_userdata(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user