aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryn M. Reeves <bmr@redhat.com>2013-11-07 17:48:03 +0000
committerBryn M. Reeves <bmr@redhat.com>2013-11-07 17:48:03 +0000
commit3439787939f096564ef9b35faf774d0c1e35a8e6 (patch)
tree40bb60fe936715a8b930c077159d25be91569023
parent7af1da54b84ddd3ef82f90d86358f2038db5cb9e (diff)
downloadsos-3439787939f096564ef9b35faf774d0c1e35a8e6.tar.gz
Fix traceback when sar module is force-enabled
Forward port of the following sos-2.2 fix: commit d4e3bcc3ed247d8d9a1228c3661b6456f534daf4 Author: Bryn M. Reeves <bmr@redhat.com> Date: Mon Aug 12 18:42:48 2013 +0100 Fix traceback when sar module is force-enabled The sar plug-in assumes that when it runs the /var/lib/sa directory and binaries exist (they are part of checkenabled() for this module). This leads to a traceback when the plug-in lists a non-existent directory on hosts where sar is not installed but '-o sar' is specified on the command line. Catch the exception and exit gracefully. (Edited by bmr to improve error message logged). Signed-off-by: David Kutálek <dkutalek@redhat.com> Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r--sos/plugins/sar.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/sos/plugins/sar.py b/sos/plugins/sar.py
index 4f89b533..570262a4 100644
--- a/sos/plugins/sar.py
+++ b/sos/plugins/sar.py
@@ -43,8 +43,12 @@ class Sar(Plugin,):
self.add_copy_spec_limit("/var/log/sa/sar[0-9]*",
sizelimit = self.sa_size)
self.add_copy_spec_limit("/var/log/sa/sa[0-9]*",
- sizelimit = self.sa_size)
- dirList = os.listdir(self.sa_path)
+ sizelimit = self.sa_size)
+ try:
+ dirList = os.listdir(self.sa_path)
+ except:
+ self.soslog.error("sar: could not list /var/log/sa")
+ return
# find all the sa file that don't have an existing sar file
for fname in dirList:
if fname[0:2] == 'sa' and fname[2] != 'r':