summaryrefslogtreecommitdiff
path: root/morphlib/builder2.py
diff options
context:
space:
mode:
authorLars Wirzenius <lars.wirzenius@codethink.co.uk>2012-06-26 11:39:21 +0100
committerLars Wirzenius <lars.wirzenius@codethink.co.uk>2012-06-26 11:39:21 +0100
commitb00ebe6baee22bd79e3aeca38a3390a25fbc5e14 (patch)
treef5208d32d2a9f8a5a16255ee6de9a062ebad633a /morphlib/builder2.py
parentc2587cf3aac2e9c734e040de86f07e950042c112 (diff)
downloadmorph-b00ebe6baee22bd79e3aeca38a3390a25fbc5e14.tar.gz
Fix test suite to deal with morph output changes
Also, some bug fixes. Also, when handling a BaseException, log the exception (with traceback) that we're handling, in case there is an error while handling it, because the second error will otherwise mask the first one.
Diffstat (limited to 'morphlib/builder2.py')
-rw-r--r--morphlib/builder2.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/morphlib/builder2.py b/morphlib/builder2.py
index aaff29d3..6bdf7cc3 100644
--- a/morphlib/builder2.py
+++ b/morphlib/builder2.py
@@ -21,6 +21,7 @@ import shutil
import time
from collections import defaultdict
import tarfile
+import traceback
import morphlib
from morphlib.artifactcachereference import ArtifactCacheReference
@@ -485,6 +486,7 @@ class SystemBuilder(BuilderBase): # pragma: no cover
self._unmount(mount_point)
except BaseException, e:
+ logging.error(traceback.format_exc())
self.app.status(msg='Error while building system',
error=True)
self._unmount(mount_point)
@@ -528,13 +530,13 @@ class SystemBuilder(BuilderBase): # pragma: no cover
image_name)
def _create_fs(self, partition):
- self.app.status(msg='Creating filesystem on %(filename)s',
- filename=image_name, chatty=True)
+ self.app.status(msg='Creating filesystem on %(partition)s',
+ partition=partition, chatty=True)
with self.build_watch('create-filesystem'):
morphlib.fsutils.create_fs(self.app.runcmd, partition)
def _mount(self, partition, mount_point):
- self.app.status(msg='Mounting %(partition) on %(mount_point)s',
+ self.app.status(msg='Mounting %(partition)s on %(mount_point)s',
partition=partition, mount_point=mount_point,
chatty=True)
with self.build_watch('mount-filesystem'):
@@ -581,8 +583,8 @@ class SystemBuilder(BuilderBase): # pragma: no cover
for stratum_artifact in self.artifact.dependencies:
f = self.local_artifact_cache.get(stratum_artifact)
for chunk in (ArtifactCacheReference(a) for a in json.load(f)):
- self.app.status(msg='Unpacking chunk %(chunk_name)s',
- chunk_name=chunk.name, chatty=True)
+ self.app.status(msg='Unpacking chunk %(basename)s',
+ basename=chunk.basename(), chatty=True)
chunk_handle = self.local_artifact_cache.get(chunk)
morphlib.bins.unpack_binary_from_file(chunk_handle, path)
chunk_handle.close()
@@ -655,10 +657,10 @@ class SystemBuilder(BuilderBase): # pragma: no cover
time.sleep(2)
def _unmount(self, mount_point):
- self.app.status(msg='Unmounting %(mount_point)s',
- mount_point=mount_point, chatty=True)
with self.build_watch('unmount-filesystem'):
if mount_point is not None:
+ self.app.status(msg='Unmounting %(mount_point)s',
+ mount_point=mount_point, chatty=True)
morphlib.fsutils.unmount(self.app.runcmd, mount_point)
def _undo_device_mapping(self, image_name):