summaryrefslogtreecommitdiff
path: root/morphlib/exts/rawdisk.write
diff options
context:
space:
mode:
authorDan Firth <dan.firth@codethink.co.uk>2013-10-10 16:07:37 +0000
committerDan Firth <dan.firth@codethink.co.uk>2013-10-14 12:00:27 +0000
commita146142f6ae7f4b20d76f68b8317eae89c4213ab (patch)
tree459700d30f7f37790fcacd770f48f0abad2227b5 /morphlib/exts/rawdisk.write
parentdf64e4300d7b39c29ce75273196a7894c86a98a9 (diff)
downloadmorph-a146142f6ae7f4b20d76f68b8317eae89c4213ab.tar.gz
Deployment failures will now remove the disk image
Diffstat (limited to 'morphlib/exts/rawdisk.write')
-rwxr-xr-xmorphlib/exts/rawdisk.write10
1 files changed, 8 insertions, 2 deletions
diff --git a/morphlib/exts/rawdisk.write b/morphlib/exts/rawdisk.write
index a74d6905..8723ac0c 100755
--- a/morphlib/exts/rawdisk.write
+++ b/morphlib/exts/rawdisk.write
@@ -46,8 +46,14 @@ class RawDiskWriteExtension(morphlib.writeexts.WriteExtension):
if os.path.isfile(location):
self.upgrade_local_system(location, temp_root)
else:
- self.create_local_system(temp_root, location)
- self.status(msg='Disk image has been created at %s' % location)
+ try:
+ self.create_local_system(temp_root, location)
+ self.status(msg='Disk image has been created at %s' % location)
+ except Exception:
+ os.remove(location)
+ self.status(msg='Failure to create disk image at %s' %
+ location)
+ raise
def upgrade_local_system(self, raw_disk, temp_root):
mp = self.mount(raw_disk)