Merge "Check to make sure the incomplete file exists before moving it during rollback. Fixes bug #888241."
This commit is contained in:
commit
105f792fa1
@ -306,11 +306,14 @@ class Driver(base.Driver):
|
||||
|
||||
def rollback(e):
|
||||
with self.get_db() as db:
|
||||
invalid_path = self.get_image_filepath(image_id, 'invalid')
|
||||
logger.debug(_("Fetch of cache file failed, rolling back by "
|
||||
"moving '%(incomplete_path)s' to "
|
||||
"'%(invalid_path)s'") % locals())
|
||||
os.rename(incomplete_path, invalid_path)
|
||||
if os.path.exists(incomplete_path):
|
||||
invalid_path = self.get_image_filepath(image_id, 'invalid')
|
||||
|
||||
logger.debug(_("Fetch of cache file failed, rolling back "
|
||||
"by moving '%(incomplete_path)s' to "
|
||||
"'%(invalid_path)s'") % locals())
|
||||
os.rename(incomplete_path, invalid_path)
|
||||
|
||||
db.execute("""DELETE FROM cached_images
|
||||
WHERE image_id = ?""", (image_id, ))
|
||||
db.commit()
|
||||
|
Loading…
x
Reference in New Issue
Block a user