aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/lib/sos/plugins/cluster.py8
-rw-r--r--src/lib/sos/plugintools.py35
-rwxr-xr-xsrc/lib/sos/policyredhat.py8
-rw-r--r--src/sos.spec9
4 files changed, 28 insertions, 32 deletions
diff --git a/src/lib/sos/plugins/cluster.py b/src/lib/sos/plugins/cluster.py
index 0d31fbc2..f291c077 100644
--- a/src/lib/sos/plugins/cluster.py
+++ b/src/lib/sos/plugins/cluster.py
@@ -37,11 +37,7 @@ class cluster(sos.plugintools.PluginBase):
return sos.plugintools.PluginBase.checkenabled(self)
def has_gfs(self):
- try:
- if len(self.doRegexFindAll(r'^\S+\s+\S+\s+gfs\s+.*$', "/etc/mtab")):
- return True
- except:
- return False
+ return (len(self.doRegexFindAll(r'^\S+\s+\S+\s+gfs\s+.*$', "/etc/mtab")) > 0)
def diagnose(self):
rhelver = self.policy().rhelVersion()
@@ -224,8 +220,6 @@ class cluster(sos.plugintools.PluginBase):
# command somehow failed
return False
- import re
-
rhelver = self.get_redhat_release()
if rhelver == "4":
diff --git a/src/lib/sos/plugintools.py b/src/lib/sos/plugintools.py
index 7272bb96..684cd9eb 100644
--- a/src/lib/sos/plugintools.py
+++ b/src/lib/sos/plugintools.py
@@ -42,12 +42,9 @@ class PluginBase:
Base class for plugins
"""
def __init__(self, pluginname, commons):
- # pylint: disable-msg = E0203
- try:
- len(self.optionList)
- except:
+ if not getattr(self, "optionList", False):
self.optionList = []
- # pylint: enable-msg = E0203
+
self.copiedFiles = []
self.copiedDirs = []
self.executedCommands = []
@@ -113,18 +110,14 @@ class PluginBase:
break
return False
- def doRegexFindAll(self,regex,fname):
+ def doRegexFindAll(self, regex, fname):
''' Return a list of all non overlapping matches in the string(s)
'''
- out=[]
- f=open(fname,'r')
- content=f.read()
- f.close()
- reg=re.compile(regex,re.MULTILINE)
- for i in reg.findall(content):
- out.append(i)
- return out
-
+ try:
+ return re.findall(regex, open(fname, 'r').read(), re.MULTILINE)
+ except: # IOError, AttributeError, etc.
+ return []
+
# Methods for copying files and shelling out
def doCopyFileOrDir(self, srcpath):
# pylint: disable-msg = R0912
@@ -311,14 +304,10 @@ class PluginBase:
self.collectProgs.append( (exe, suggest_filename, root_symlink, timeout) )
def fileGrep(self, regexp, fname):
- results = []
-
- fp = open(fname, "r")
- for line in fp.readlines():
- if re.match(regexp, line):
- results.append(line)
- fp.close()
- return results
+ try:
+ return [l for l in open(fname).readlines() if re.match(regexp, l)]
+ except: # IOError, AttributeError, etc.
+ return []
def mangleCommand(self, exe):
# FIXME: this can be improved
diff --git a/src/lib/sos/policyredhat.py b/src/lib/sos/policyredhat.py
index dc0a9823..26004140 100755
--- a/src/lib/sos/policyredhat.py
+++ b/src/lib/sos/policyredhat.py
@@ -209,6 +209,14 @@ class SosPolicy:
if len(self.reportName) == 0:
self.reportName = localname
+
+ if self.cInfo['cmdlineopts'].customerName:
+ self.reportName = self.cInfo['cmdlineopts'].customerName
+ self.reportName = re.sub(r"[^a-zA-Z.0-9]", "", self.reportName)
+
+ if self.cInfo['cmdlineopts'].ticketNumber:
+ self.ticketNumber = self.cInfo['cmdlineopts'].ticketNumber
+ self.ticketNumber = re.sub(r"[^0-9]", "", self.ticketNumber)
return
diff --git a/src/sos.spec b/src/sos.spec
index 6457b43f..52020096 100644
--- a/src/sos.spec
+++ b/src/sos.spec
@@ -3,8 +3,8 @@
Summary: A set of tools to gather troubleshooting information from a system
Name: sos
Version: 1.8
-Release: 13%{?dist}
-Group: Application/Tools
+Release: 14%{?dist}
+Group: Applications/System
Source0: https://fedorahosted.org/releases/s/o/sos/%{name}-%{version}.tar.gz
License: GPLv2+
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
@@ -53,6 +53,11 @@ rm -rf ${RPM_BUILD_ROOT}
%config %{_sysconfdir}/sos.conf
%changelog
+* Thu Jul 23 2009 Adam Stokes <ajs at redhat dot com> = 1.8-14
+- resolves: rhbz512536 wrong group in spec file
+- resolves: rhbz498398 A series of refactoring patches to sos
+- resolves: rhbz502455 tricking sosreport into rm -rf /
+
* Mon Jul 20 2009 Adam Stokes <ajs at redhat dot com> = 1.8-13
- Add requirements for tar,bzip2 during minimal installs
- More merges from reports against RHEL version of plugins