From c8bbe2d1490107b86425ae72e766b7c2d6d86ebb Mon Sep 17 00:00:00 2001 From: "Bryn M. Reeves" Date: Mon, 10 Jun 2013 18:01:29 +0100 Subject: Test for symlink existence before creation There are cases where we may attempt to add a symlink to the archive more than once. Since this will fail for paths that already exist test for their presence first. Signed-off-by: Bryn M. Reeves --- sos/archive.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sos/archive.py b/sos/archive.py index 807c0431..42916606 100644 --- a/sos/archive.py +++ b/sos/archive.py @@ -132,7 +132,8 @@ class FileCacheArchive(Archive): def add_link(self, source, link_name): dest = self.dest_path(link_name) self._check_path(dest) - os.symlink(source, dest) + if not os.path.exists(dest): + os.symlink(source, dest) self.log.debug("added symlink at %s to %s in FileCacheArchive %s" % (dest, source, self._archive_root)) -- cgit