From b13dfc6437ab14bff801607c6124292aefcc48b2 Mon Sep 17 00:00:00 2001 From: Adrien Ferrand Date: Tue, 21 Jul 2020 01:01:09 +0200 Subject: [PATCH] Do not create the symlink for test assets on Windows if the asset path is already a symlink (#8159) --- certbot-ci/certbot_integration_tests/utils/misc.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/certbot-ci/certbot_integration_tests/utils/misc.py b/certbot-ci/certbot_integration_tests/utils/misc.py index 9d1676c60..38c2e60a8 100644 --- a/certbot-ci/certbot_integration_tests/utils/misc.py +++ b/certbot-ci/certbot_integration_tests/utils/misc.py @@ -279,16 +279,17 @@ def load_sample_data_path(workspace): shutil.copytree(original, copied, symlinks=True) if os.name == 'nt': - # Fix the symlinks on Windows since GIT is not creating them upon checkout + # Fix the symlinks on Windows if GIT is not configured to create them upon checkout for lineage in ['a.encryption-example.com', 'b.encryption-example.com']: current_live = os.path.join(copied, 'live', lineage) for name in os.listdir(current_live): if name != 'README': current_file = os.path.join(current_live, name) - with open(current_file) as file_h: - src = file_h.read() - os.unlink(current_file) - os.symlink(os.path.join(current_live, src), current_file) + if not os.path.islink(current_file): + with open(current_file) as file_h: + src = file_h.read() + os.unlink(current_file) + os.symlink(os.path.join(current_live, src), current_file) return copied