diff options
author | Bryn M. Reeves <bmr@redhat.com> | 2013-06-10 18:01:29 +0100 |
---|---|---|
committer | Bryn M. Reeves <bmr@redhat.com> | 2013-06-10 18:01:29 +0100 |
commit | c8bbe2d1490107b86425ae72e766b7c2d6d86ebb (patch) | |
tree | c691892cb5561c5c7205d17ca4fab000d740502f | |
parent | ea3f441130ed3e8e5b494b08296f138cd9518ee3 (diff) | |
download | sos-c8bbe2d1490107b86425ae72e766b7c2d6d86ebb.tar.gz |
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 <bmr@redhat.com>
-rw-r--r-- | sos/archive.py | 3 |
1 files changed, 2 insertions, 1 deletions
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)) |