Skip to content
Snippets Groups Projects
Unverified Commit 64209dda authored by Peter Josef Scheibel's avatar Peter Josef Scheibel Committed by Todd Gamblin
Browse files

Allow repeated invocations of 'mirror create'

When creating a cosmetic symlink for a resource in a mirror, remove
it if it already exists. The symlink is removed in case the logic to
create the symlink has changed.
parent c15e55c6
No related branches found
No related tags found
No related merge requests found
......@@ -70,7 +70,13 @@ def symlink(self, mirror_ref):
relative_dst = os.path.relpath(
mirror_ref.storage_path,
start=os.path.dirname(cosmetic_path))
if not os.path.exists(cosmetic_path):
if os.path.lexists(cosmetic_path):
# In this case the link itself exists but it is broken: remove
# it and recreate it (in order to fix any symlinks broken prior
# to https://github.com/spack/spack/pull/13908)
os.unlink(cosmetic_path)
mkdirp(os.path.dirname(cosmetic_path))
os.symlink(relative_dst, cosmetic_path)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment