diff options
author | Jannis Pohlmann <jannis.pohlmann@codethink.co.uk> | 2012-02-24 10:47:50 +0000 |
---|---|---|
committer | Jannis Pohlmann <jannis.pohlmann@codethink.co.uk> | 2012-02-24 10:47:50 +0000 |
commit | e543fc5760dde600c9699955214e7392954f0778 (patch) | |
tree | 7b4e82436945dbde44f2abb277492393ed18d249 /morphlib | |
parent | d5fa85b98a213c5e8410a4a4556f65162d7ad2c7 (diff) | |
download | morph-e543fc5760dde600c9699955214e7392954f0778.tar.gz |
Make sure to always remove bundles on errors or when we've cloned them.
Diffstat (limited to 'morphlib')
-rw-r--r-- | morphlib/sourcemanager.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/morphlib/sourcemanager.py b/morphlib/sourcemanager.py index b4949ad4..e1d1f33c 100644 --- a/morphlib/sourcemanager.py +++ b/morphlib/sourcemanager.py @@ -129,8 +129,14 @@ class SourceManager(object): self.msg('Unable to extract bundle %s' % bundle) return None, 'Unable to extract bundle %s: %s' % (bundle, e) + finally: + if os.path.exists(bundle): + os.remove(bundle) except morphlib.execute.CommandFailure, e: # pragma: no cover return None, 'Unable to fetch bundle %s: %s' % (bundle, e) + finally: + if os.path.exists(bundle): + os.remove(bundle) except urllib2.URLError, e: return None, 'Unable to fetch bundle %s: %s' % (bundle_url, e) |