summaryrefslogtreecommitdiff
path: root/morphlib/builder2.py
diff options
context:
space:
mode:
authorSam Thursfield <sam.thursfield@codethink.co.uk>2012-11-15 14:55:45 +0000
committerSam Thursfield <sam.thursfield@codethink.co.uk>2012-11-15 16:57:36 +0000
commit5da1f9b9a94ef139729143aa2c1f649aa809b86b (patch)
treedf297db013b94fc7e78524c9af739c93272aeb4e /morphlib/builder2.py
parentcc5913c56a2ae55eb6254e352592751e194b6cd9 (diff)
downloadmorph-5da1f9b9a94ef139729143aa2c1f649aa809b86b.tar.gz
Cleanly handle out of disk space on target filesystem.
Includes new test.
Diffstat (limited to 'morphlib/builder2.py')
-rw-r--r--morphlib/builder2.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/morphlib/builder2.py b/morphlib/builder2.py
index d8ed829a..674cbb17 100644
--- a/morphlib/builder2.py
+++ b/morphlib/builder2.py
@@ -15,6 +15,7 @@
import datetime
+import errno
import json
import logging
import os
@@ -715,7 +716,12 @@ class DiskImageBuilder(SystemKindBuilder): # pragma: no cover
error=True)
self._unmount(mount_point)
self._undo_device_mapping(image_name)
- raise
+ if type(e) is IOError and e.errno==errno.ENOSPC:
+ raise cliapp.AppException(
+ 'Ran out of space on %s disk image. Please '
+ 'increase the system\'s disk-size.' % rootfs_name)
+ else:
+ raise
self._unmount(mount_point)
self._undo_device_mapping(image_name)