aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryn M. Reeves <bmr@redhat.com>2012-12-12 14:16:44 +0000
committerBryn M. Reeves <bmr@redhat.com>2012-12-12 14:16:44 +0000
commit5a792dd1829449f9bfa74734150b5dd43cd02578 (patch)
treefe59f621acdf343a1eee8a3b94ff51464f8cfc6d
parent2b1b476ee10ecca99364520c2140ea5aa39f5382 (diff)
downloadsos-5a792dd1829449f9bfa74734150b5dd43cd02578.tar.gz
Re-work sunrpc module to make porting easier
Re-organise the sunrpc module so that the service check is in the base (Plugin-derived) class but uses a service string defined only in the subclasses. This allows the same checkenabled() to be used for any policy that implements the needed runlevelByService() API. This can serve as a prototype for a generic enabled-by-service facility (mimicking existing files and packages checks) although it currently needs considerable work to review and revise the service and runlevel interfaces in the policy modules. Related to Issue #77
-rw-r--r--sos/plugins/sunrpc.py32
1 files changed, 28 insertions, 4 deletions
diff --git a/sos/plugins/sunrpc.py b/sos/plugins/sunrpc.py
index deba5dd9..cd472e50 100644
--- a/sos/plugins/sunrpc.py
+++ b/sos/plugins/sunrpc.py
@@ -16,15 +16,39 @@
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
-class sunrpc(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
+class sunrpc(Plugin):
"""Sun RPC related information
"""
+
+ plugin_name = "sunrpc"
+ service = None
+
def checkenabled(self):
- if self.policy().runlevelDefault() in self.policy().runlevelByService("rpcbind"):
- return True
- return False
+ if self.policy().runlevelDefault() in \
+ self.policy().runlevelByService(self.service):
+ return True
+ return False
def setup(self):
self.collectExtOutput("/usr/sbin/rpcinfo -p localhost")
return
+class RedHatSunrpc(sunrpc, RedHatPlugin):
+ """Sun RPC related information for Red Hat systems
+ """
+
+ service = 'rpcbind'
+
+# FIXME: depends on addition of runlevelByService (or similar)
+# in Debian/Ubuntu policy classes
+#class DebianSunrpc(sunrpc, DebianPlugin, UbuntuPlugin):
+# """Sun RPC related information for Red Hat systems
+# """
+#
+# service = 'rpcbind-boot'
+#
+# def setup(self):
+# self.collectExtOutput("/usr/sbin/rpcinfo -p localhost")
+# return
+
+