Commit 899f5736 by Máhonfai Bálint

Fix errors with unlinking

parent 2b4ce60c
...@@ -301,16 +301,19 @@ class Disk(object): ...@@ -301,16 +301,19 @@ class Disk(object):
self.get_path()] self.get_path()]
subprocess.check_output(cmdline) subprocess.check_output(cmdline)
except AbortException: except AbortException:
if os.path.exists(downloaded_file):
os.unlink(downloaded_file) os.unlink(downloaded_file)
if os.path.exists(self.get_path()): if os.path.exists(self.get_path()):
os.unlink(self.get_path()) os.unlink(self.get_path())
logger.info("Import of disk %s aborted" % self.name) logger.info("Import of disk %s aborted" % self.name)
except: except:
if os.path.exists(downloaded_file):
os.unlink(downloaded_file) os.unlink(downloaded_file)
if os.path.exists(self.get_path()): if os.path.exists(self.get_path()):
os.unlink(self.get_path()) os.unlink(self.get_path())
raise raise
else: else:
if os.path.exists(downloaded_file):
os.unlink(downloaded_file) os.unlink(downloaded_file)
if not self.check_valid_image(): if not self.check_valid_image():
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment