diff options
author | shnavid <shnavid@ef72aa8b-4018-0410-8976-d6e080ef94d8> | 2007-07-18 09:44:49 +0000 |
---|---|---|
committer | shnavid <shnavid@ef72aa8b-4018-0410-8976-d6e080ef94d8> | 2007-07-18 09:44:49 +0000 |
commit | e436513dd9001055a50235fa031816f23a63a08b (patch) | |
tree | 2594e4de57a1b37d3bb506daee1b6d611801dada | |
parent | 5be45d4fe951c1eef6613d99fa543dad7c5cac68 (diff) | |
download | sos-e436513dd9001055a50235fa031816f23a63a08b.tar.gz |
* added three helpers: pkgDictByName() runlevelByService() and runlevelDefault()
git-svn-id: svn+ssh://svn.fedorahosted.org/svn/sos/trunk@212 ef72aa8b-4018-0410-8976-d6e080ef94d8
-rwxr-xr-x | src/lib/sos/policyredhat.py | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/lib/sos/policyredhat.py b/src/lib/sos/policyredhat.py index e31900d7..b3c887f3 100755 --- a/src/lib/sos/policyredhat.py +++ b/src/lib/sos/policyredhat.py @@ -69,6 +69,28 @@ class SosPolicy: return pkg + def pkgDictByName(self, name): + pkgName = self.pkgByName(name) + if pkgName and len(pkgName) > len(name): + return pkgName[len(name)+1:].split("-") + else: + return None + + def runlevelByService(self, name): + ret = [] + try: + for tabs in commands.getoutput("/sbin/chkconfig --list %s" % name).split(): + (runlevel, onoff) = tabs.split(":") + if onoff == "on": + ret.append(int(runlevel)) + except: + pass + return ret + + def runlevelDefault(self): + # FIXME: get this from /etc/inittab + return 3 + def pkgNVRA(self, pkg): fields = pkg.split("-") version, release, arch = fields[-3:] @@ -84,7 +106,7 @@ class SosPolicy: ticketNumber = raw_input("Please enter the case number that you are generating this report for: ") except KeyboardInterrupt: print "<interrupted>" - print + return if len(ticketNumber): namestr = name + "." + ticketNumber |