aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lib/sos/plugins/dhcp.py6
-rw-r--r--src/lib/sos/plugintools.py8
-rwxr-xr-xsrc/lib/sos/policyredhat.py2
3 files changed, 9 insertions, 7 deletions
diff --git a/src/lib/sos/plugins/dhcp.py b/src/lib/sos/plugins/dhcp.py
index 7866f4e9..b7e5cbd9 100644
--- a/src/lib/sos/plugins/dhcp.py
+++ b/src/lib/sos/plugins/dhcp.py
@@ -18,9 +18,9 @@ class dhcp(sos.plugintools.PluginBase):
"""DHCP related information
"""
def checkenabled(self):
- if self.cInfo["policy"].pkgByName("dhcp") or os.path.exists("/etc/rc.d/init.d/dhcpd"):
- return True
- return False
+ self.files ['/etc/rc.d/init.d/dhcpd']
+ self.packages = ['dhcp']
+ return sos.plugintools.PluginBase.checkenabled(self)
def setup(self):
self.addCopySpec("/etc/sysconfig/dhcrelay")
diff --git a/src/lib/sos/plugintools.py b/src/lib/sos/plugintools.py
index e00fa0f0..7272bb96 100644
--- a/src/lib/sos/plugintools.py
+++ b/src/lib/sos/plugintools.py
@@ -35,6 +35,8 @@ import shutil
from stat import *
from time import time
+class PluginException(Exception): pass
+
class PluginBase:
"""
Base class for plugins
@@ -192,8 +194,8 @@ class PluginBase:
self.soslog.log(logging.VERBOSE3, "copying file %s" % srcpath)
try:
tdstpath, abspath = self.__copyFile(srcpath)
- except "AlreadyExists":
- self.soslog.log(logging.DEBUG, "error copying file %s (already exists)" % (srcpath))
+ except PluginException, e:
+ self.soslog.log(logging.DEBUG, "%s: %s" % (srcpath,e))
return
except IOError:
self.soslog.log(logging.VERBOSE2, "error copying file %s (IOError)" % (srcpath))
@@ -225,7 +227,7 @@ class PluginBase:
else:
shutil.copy2(src, new_dir)
else:
- raise "AlreadyExists"
+ raise PluginException('Error copying file: already exists')
abspath = os.path.join(self.cInfo['dstroot'], src.lstrip(os.path.sep))
relpath = sosRelPath(self.cInfo['rptdir'], abspath)
diff --git a/src/lib/sos/policyredhat.py b/src/lib/sos/policyredhat.py
index de0dfa49..dc0a9823 100755
--- a/src/lib/sos/policyredhat.py
+++ b/src/lib/sos/policyredhat.py
@@ -275,7 +275,7 @@ class SosPolicy:
# calculate md5
fp = open(self.report_file, "r")
- self.report_md5 = hashlib.md5(fp.read()).digest()
+ self.report_md5 = hashlib.md5(fp.read()).hexdigest()
fp.close()
self.renameResults("sosreport-%s-%s-%s.tar.bz2" % (self.reportName, time.strftime("%Y%m%d%H%M%S"), self.report_md5[-4:]))