aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJake Hunsaker <jhunsake@redhat.com>2020-08-17 14:23:21 -0400
committerJake Hunsaker <jhunsake@redhat.com>2020-08-17 14:23:21 -0400
commit802bce74f9f83a8a2e9812407ea79bd27b4dd2ae (patch)
treeba7a7579d4d03231f8e7d8aa0840f046bd2ae075
parent4dc4fe89c7e7dbd4576f09e4fa8553b04c0ae686 (diff)
downloadsos-802bce74f9f83a8a2e9812407ea79bd27b4dd2ae.tar.gz
[archive] Re-order exception handling in add_file
Re orders the order of exception handling within add_file(), to avoid an unreachable OSError as highlighted by LGTM. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
-rw-r--r--sos/archive.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/sos/archive.py b/sos/archive.py
index 31cfa1fa..a86b034e 100644
--- a/sos/archive.py
+++ b/sos/archive.py
@@ -340,14 +340,14 @@ class FileCacheArchive(Archive):
# path case
try:
shutil.copy(src, dest)
+ except OSError as e:
+ self.log_info("File not collected: '%s'" % e)
except IOError as e:
# Filter out IO errors on virtual file systems.
if src.startswith("/sys/") or src.startswith("/proc/"):
pass
else:
self.log_info("caught '%s' copying '%s'" % (e, src))
- except OSError as e:
- self.log_info("File not collected: '%s'" % e)
# copy file attributes, skip SELinux xattrs for /sys and /proc
try: