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