aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Moravec <pmoravec@redhat.com>2017-03-26 21:07:21 +0200
committerBryn M. Reeves <bmr@redhat.com>2017-03-27 17:25:32 +0100
commit68f1702e19c170c9e94020108dee8b042a702e21 (patch)
tree1fa40baa48f8e44a27c0048d2b5d00ad24902f3c
parent3b797f1a79b051a255295d938e8d525f038bd940 (diff)
downloadsos-68f1702e19c170c9e94020108dee8b042a702e21.tar.gz
[collectd] Traceback when /etc/collectd.conf not readable
Catch IOError when opening /etc/collectd.conf and log it as a warning. Resolves: #968, #976. Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
-rw-r--r--sos/plugins/collectd.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/sos/plugins/collectd.py b/sos/plugins/collectd.py
index a458371a..87f5c255 100644
--- a/sos/plugins/collectd.py
+++ b/sos/plugins/collectd.py
@@ -31,11 +31,14 @@ class Collectd(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
])
p = re.compile('^LoadPlugin.*')
- with open("/etc/collectd.conf") as f:
- for line in f:
- if p.match(line):
- self.add_alert("Active Plugin found: %s" %
- line.split()[-1])
+ try:
+ with open("/etc/collectd.conf") as f:
+ for line in f:
+ if p.match(line):
+ self.add_alert("Active Plugin found: %s" %
+ line.split()[-1])
+ except IOError as e:
+ self._log_warn("could not open /etc/collectd.conf: %s" % e)
def postproc(self):
# add these to protect_keys if need be: