summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey <jcollie@fedoraproject.org>2007-01-29 15:23:42 (GMT)
committerYaakov M. Nemoy <loupgaroublond@gmail.com>2007-01-29 15:23:42 (GMT)
commit2f4ed068ebd6e255ad1364c031c230fa280445f4 (patch)
treef7c56a01fe9242435ebbf7e475bb4de19dd189ca
parentd6fc76abbc54adc53d3ca2e30772e50ee75b568b (diff)
downloadsmolt-2f4ed068ebd6e255ad1364c031c230fa280445f4.zip
smolt-2f4ed068ebd6e255ad1364c031c230fa280445f4.tar.gz
smolt-2f4ed068ebd6e255ad1364c031c230fa280445f4.tar.xz
Restore the code factorization for some of our local code.
-rw-r--r--hw-client/Profile.py28
1 files changed, 7 insertions, 21 deletions
diff --git a/hw-client/Profile.py b/hw-client/Profile.py
index 6fbf038..263cb3c 100644
--- a/hw-client/Profile.py
+++ b/hw-client/Profile.py
@@ -1,13 +1,11 @@
#!/usr/bin/python
import hardware
+import software
import sys
import os
-import commands
import re
-initdefault_re = re.compile(r':(\d+):initdefault:')
-
# use hardware to get what we need as different archs get data from different
# functions. namely dmi is a bios only thing while ppc and sparc have the
# information elsewhere.
@@ -29,24 +27,12 @@ class Profile:
self.hw = hardware.Hardware()
- self.lsbRelease = ''
- if os.access('/usr/bin/lsb_release', os.X_OK):
- self.lsbRelease = commands.getstatusoutput('/usr/bin/lsb_release')[1]
-
- try:
- self.OS = file('/etc/redhat-release').read()
- except IOError:
- self.OS = 'Unknown'
-
- self.defaultRunlevel = 'Unknown'
- try:
- inittab = file('/etc/inittab').read()
- match = initdefault_re.search(inittab)
- if match:
- self.defaultRunlevel = match.group(1)
- except IOError:
- sys.stderr.write('Unable to read /etc/inittab, continuing...')
-
+ self.lsbRelease = software.read_lsb_release()
+
+ self.OS = software.read_os()
+
+ self.defaultRunlevel = software.read_runlevel()
+
self.language = os.environ['LANG']
self.platform = self.bogomips = self.CPUVendor = self.numCPUs = self.CPUSpeed = self.systemMemory = self.systemSwap = self.vendor = self.system = ''