diff options
author | Jan Jansky <jjansky@redhat.com> | 2019-12-11 12:47:18 +0100 |
---|---|---|
committer | Bryn M. Reeves <bmr@redhat.com> | 2020-02-14 18:50:14 +0000 |
commit | 75e921157bb7b63642648fabeeac7f9795a1940f (patch) | |
tree | 0be4c2fd1f09cc164132989e58fb1d3c7a4b1cf9 | |
parent | b39bf13cd0ba8dcdd012bac79c310c9b3c4ea196 (diff) | |
download | sos-75e921157bb7b63642648fabeeac7f9795a1940f.tar.gz |
[archive] handle OSErrors
If file/folder will be present during file list creation, but will be
missing during collection OSError will throw exception
FileNotFoundError: [Errno 2] No such file or directory
Added handling of OSError into sos/archive.py and new log message with
info level to sos_logs/sos.log
Resolves: #1890
Signed-off-by: Jan Jansky <jjansky@redhat.com>
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r-- | sos/archive.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/sos/archive.py b/sos/archive.py index 28578570..b53e50ba 100644 --- a/sos/archive.py +++ b/sos/archive.py @@ -348,6 +348,9 @@ class FileCacheArchive(Archive): 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: stat = os.stat(src) |