diff options
author | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2014-12-09 13:13:05 +0000 |
---|---|---|
committer | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2014-12-09 13:58:53 +0000 |
commit | 8557427c00aecf63bbd0090395acdaf659e77e0f (patch) | |
tree | 5f8380c02bd0cfba623a3f823919af6020b3d5db /morphlib/stagingarea.py | |
parent | ca24c606a043dd9dd6a380248f9d4d6dff3db597 (diff) | |
download | morph-8557427c00aecf63bbd0090395acdaf659e77e0f.tar.gz |
Give a useful path to failed staging areas
Morph tells the user that an error occurred in the staging area, then
moves the staging area somewhere else. Giving the old path rather than
the new path is pretty annoying.
Diffstat (limited to 'morphlib/stagingarea.py')
-rw-r--r-- | morphlib/stagingarea.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/morphlib/stagingarea.py b/morphlib/stagingarea.py index 7060382a..e7783890 100644 --- a/morphlib/stagingarea.py +++ b/morphlib/stagingarea.py @@ -300,7 +300,12 @@ class StagingArea(object): msg = morphlib.util.error_message_for_containerised_commandline( argv, err, container_config) raise cliapp.AppException( - 'In staging area %s: %s' % (self.dirname, msg)) + 'In staging area %s: %s' % (self._failed_location(), msg)) + + def _failed_location(self): # pragma: no cover + '''Path this staging area will be moved to if an error occurs.''' + return os.path.join(self._app.settings['tempdir'], 'failed', + os.path.basename(self.dirname)) def abort(self): # pragma: no cover '''Handle what to do with a staging area in the case of failure. @@ -309,9 +314,7 @@ class StagingArea(object): # TODO: when we add the option to throw away failed builds, # hook it up here - - dest_dir = os.path.join(self._app.settings['tempdir'], - 'failed', os.path.basename(self.dirname)) + dest_dir = self._failed_location() os.rename(self.dirname, dest_dir) self.dirname = dest_dir |