summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey <jcollie@fedoraproject.org>2007-01-29 15:42:00 (GMT)
committerYaakov M. Nemoy <loupgaroublond@gmail.com>2007-01-29 15:42:00 (GMT)
commit476f23bee7542235b515c35c044ef3d776c1318a (patch)
tree321b6f63c9825982bbc3fe7d313f8a9b0680ea45
parent251b4ff03e22bef8b27a429187e1e5d70def1c5d (diff)
parent78fe7bac9c9809642eaea800a6dd91fe8926fcdb (diff)
downloadsmolt-476f23bee7542235b515c35c044ef3d776c1318a.zip
smolt-476f23bee7542235b515c35c044ef3d776c1318a.tar.gz
smolt-476f23bee7542235b515c35c044ef3d776c1318a.tar.xz
Pulling in recent updates.
-rw-r--r--.hgsigs2
-rw-r--r--hw-client/Profile.py34
2 files changed, 12 insertions, 24 deletions
diff --git a/.hgsigs b/.hgsigs
index 3f96f31..d480687 100644
--- a/.hgsigs
+++ b/.hgsigs
@@ -9,3 +9,5 @@ e0e65080cf0550a8dee83d50575f42b3522cb4b5 0 iD8DBQBFuugHrtk7xyyIQRERAhKKAJ0U+j9Z1
975787190dddfe7c51f7828d6a3c6ac9ac1d3ccf 0 iD8DBQBFuuiOrtk7xyyIQRERApqCAJ9RsEsbk6SqSznMe/qpOHjN6c0HCACeMFPifAZy8eV8eP1j6eWFBd2IEaU=
d3f1ef3a532f7b257ff9c3e2f100c527f91c4b0b 0 iD8DBQBFvDHSrtk7xyyIQRERAtOFAJ0UwnX4nd91JdW9ajf72XuFEtKaUQCdFYu4FfF0GWvPIFgWakk/OceNWRI=
e1464c00b2d8e1eb247129f02d20ae9925434f21 0 iD8DBQBFvNhurtk7xyyIQRERAqc5AJ9PgG8beAPJt08A/FZXVvr4WHNJ6gCffSbiNss3zSp8fre+7i5En9ZX81w=
+0f495b51635fbda8e880bc239a6db77c3f16ac5b 0 iD8DBQBFvhHartk7xyyIQRERAptgAKCGQuwLO+gqYzNerdoJDc+FJnWuxACff2Cxhh58dlHoWqTd8txj2qf+yRQ=
+50fe2653b377350631783b82a6732b6c36e7c494 0 iD8DBQBFvhHdrtk7xyyIQRERAnmTAJ0eRjO33La1fQjtpou53fxsS1NFsACfbwOoh7iA+/Pxs9aUFh2Ov0Rgc20=
diff --git a/hw-client/Profile.py b/hw-client/Profile.py
index bc4de14..01532b5 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.
@@ -30,24 +28,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 = ''
@@ -71,11 +57,12 @@ class Profile:
self.system = device['system']
except:
pass
-# Defaults for when hardware doesnt return anything. namely a new cpu type
+
+ # Defaults for when hardware doesnt return anything. namely a new cpu type
if self.platform == '':
self.platform = 'Unknown'
if self.bogomips == '':
- self.bogomips = 0
+ self.bogomips = 1
if self.CPUVendor == '':
self.CPUVendor = 'Unknown'
if self.numCPUs == '':
@@ -91,7 +78,6 @@ class Profile:
if self.system == '':
self.system = 'Unknown'
-
def get_host_string(self):
return "UUID=%s&lsbRelease=%s&OS=%s&defaultRunlevel=%s&language=%s&platform=%s&bogomips=%s&CPUVendor=%s&numCPUs=%s&CPUSpeed=%s&systemMemory=%s&systemSwap=%s&vendor=%s&system=%s" % (self.UUID, self.lsbRelease, self.OS, self.defaultRunlevel, self.language, self.platform, self.bogomips, self.CPUVendor, self.numCPUs, self.CPUSpeed, self.systemMemory, self.systemSwap, self.vendor, self.system)