aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Moravec <pmoravec@redhat.com>2018-11-05 10:28:06 +0100
committerBryn M. Reeves <bmr@redhat.com>2019-03-18 20:02:58 +0000
commit98759887a383287a074faf15436a819c986eca03 (patch)
tree332ddbc7a1223f2815f416ac6064130332476b43
parent26e02e5864560c82d9594818a96982d62e13df33 (diff)
downloadsos-98759887a383287a074faf15436a819c986eca03.tar.gz
[plugins] Decrease log verbosity when do_file_sub failed on missing file
In case do_file_sub fails to apply a substitution on a non-existing file, don't log it as an error log to stdout. Resolves: #1471 Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
-rw-r--r--sos/plugins/__init__.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py
index d8582670..2e30d86b 100644
--- a/sos/plugins/__init__.py
+++ b/sos/plugins/__init__.py
@@ -354,8 +354,14 @@ class Plugin(object):
else:
replacements = 0
except Exception as e:
- msg = "regex substitution failed for '%s' with: '%s'"
- self._log_error(msg % (path, e))
+ # if trying to regexp a nonexisting file, dont log it as an
+ # error to stdout
+ if e.errno == errno.ENOENT:
+ msg = "file '%s' not collected, substitution skipped"
+ self._log_debug(msg % path)
+ else:
+ msg = "regex substitution failed for '%s' with: '%s'"
+ self._log_error(msg % (path, e))
replacements = 0
return replacements