diff options
author | Jan Grant <jan.grant@hp.com> | 2015-10-08 12:17:26 +0100 |
---|---|---|
committer | Bryn M. Reeves <bmr@redhat.com> | 2015-10-15 12:33:34 +0100 |
commit | ed97b1467173b7f41b49b822fcef8e87759b20c6 (patch) | |
tree | 8dfc98eb0fd37478d233bc635f0df25b9341a7bb | |
parent | 76d6c40c8067a2d4c07f8f9eb2c7bfc9e4542b23 (diff) | |
download | sos-ed97b1467173b7f41b49b822fcef8e87759b20c6.tar.gz |
[archive] Don't try to overwrite dangling symlinks
The test for a symlink already existing would fail if the symlink
target did not exist; this will be the case when a symlink points
to a directory (which is not copied).
Fix up to use os.lexists instead.
Closes: #660
Closes: #661
Signed-off-by: jan grant <jang@ioctl.org>
-rw-r--r-- | sos/archive.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sos/archive.py b/sos/archive.py index 0336aabe..0b968517 100644 --- a/sos/archive.py +++ b/sos/archive.py @@ -195,7 +195,7 @@ class FileCacheArchive(Archive): def add_link(self, source, link_name): dest = self.dest_path(link_name) self._check_path(dest) - if not os.path.exists(dest): + if not os.path.lexists(dest): os.symlink(source, dest) self.log_debug("added symlink at '%s' to '%s' in FileCacheArchive '%s'" % (dest, source, self._archive_root)) |