diff options
-rw-r--r-- | lib/spack/spack/repo.py | 6 |
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 |