[sos-devel] [PATCH] New plugin : RHSM

Cedric Buissart cbuissar at redhat.com
Thu May 3 15:32:45 UTC 2012


Hi,

RHSM, the certificate based entitlement used in recent RHEL (default registration method in 6.2 and 5.8 afaik) should have its plugin.

Below is a quick small patch that retrieves some basic info :
* configuration (the proxy password is ***'ed)
* log
* additional info about the machine's ID and addon subscriptions.
* plugin is currently enabled by default. Let me know if we should override `checkenabled`

Cheers,

Cedric


-----------------------

diff --git a/sos/plugins/rhsm.py b/sos/plugins/rhsm.py
new file mode 100755
index 0000000..1896fb5
--- /dev/null
+++ b/sos/plugins/rhsm.py
@@ -0,0 +1,34 @@
+### This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2 of the License, or
+## (at your option) any later version.
+
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+from sos.plugins import Plugin, RedHatPlugin
+
+class rhsm(Plugin, RedHatPlugin):
+    '''RHSM is the new certificate based Red Hat subscription management'''
+
+    def setup(self):
+       # Copy the RHSM configuration file
+       # XXX : let's not get the PEM files
+       self.addCopySpec("/etc/rhsm/rhsm.conf")
+
+       # Copy the RHSM Logs
+       self.addCopySpec("/var/log/rhsm/")
+       
+       # Gathering generic data about identity and add-on consumption
+       self.collectExtOutput("/usr/sbin/subscription-manager identity")
+       self.collectExtOutput("/usr/sbin/subscription-manager list --installed --consumed")
+
+    def postproc(self):
+       self.doRegexSub("/etc/rhsm/rhsm.conf", r"(\s*proxy_password\s*=\s*)\S+", r"\1%s" %('***'))
+




More information about the sos-devel mailing list