summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMassimiliano Culpo <massimiliano.culpo@gmail.com>2019-04-12 23:01:26 +0200
committerPeter Scheibel <scheibel1@llnl.gov>2019-04-18 18:41:22 -0700
commit9cf650d2abf71ba4a41db0158f1b5090a37e5ead (patch)
tree78df6cdb635ca8ae001cfaa0400de9f59b928139
parent400aa5fe515f90e4c9034fa4d5607f59c307594b (diff)
downloadspack-9cf650d2abf71ba4a41db0158f1b5090a37e5ead.tar.gz
spack-9cf650d2abf71ba4a41db0158f1b5090a37e5ead.tar.bz2
spack-9cf650d2abf71ba4a41db0158f1b5090a37e5ead.tar.xz
spack-9cf650d2abf71ba4a41db0158f1b5090a37e5ead.zip
Moved cleanup before raising (the code couldn't be reached before)
-rw-r--r--lib/spack/spack/repo.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/spack/spack/repo.py b/lib/spack/spack/repo.py
index 00928d84b6..26780e1b8a 100644
--- a/lib/spack/spack/repo.py
+++ b/lib/spack/spack/repo.py
@@ -1138,9 +1138,6 @@ def create_repo(root, namespace=None):
config.write(" namespace: '%s'\n" % namespace)
except (IOError, OSError) as e:
- raise BadRepoError('Failed to create new repository in %s.' % root,
- "Caused by %s: %s" % (type(e), e))
-
# try to clean up.
if existed:
shutil.rmtree(config_path, ignore_errors=True)
@@ -1148,6 +1145,9 @@ def create_repo(root, namespace=None):
else:
shutil.rmtree(root, ignore_errors=True)
+ raise BadRepoError('Failed to create new repository in %s.' % root,
+ "Caused by %s: %s" % (type(e), e))
+
return full_path, namespace