summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordennis@daedalus.ausil.us <>2007-01-26 19:58:23 (GMT)
committerYaakov M. Nemoy <loupgaroublond@gmail.com>2007-01-26 19:58:23 (GMT)
commitf31fd79ff8eefe1d20cab824e2ed993ddb353a66 (patch)
tree9890a332526ca29d2088b48405fe20f01a05e066
parent51e5cce061cdccc38506eabd898636914aff9ca6 (diff)
downloadsmolt-f31fd79ff8eefe1d20cab824e2ed993ddb353a66.zip
smolt-f31fd79ff8eefe1d20cab824e2ed993ddb353a66.tar.gz
smolt-f31fd79ff8eefe1d20cab824e2ed993ddb353a66.tar.xz
add script to read the profile useful for testing
-rwxr-xr-xhw-client/readProfile.py96
1 files changed, 96 insertions, 0 deletions
diff --git a/hw-client/readProfile.py b/hw-client/readProfile.py
new file mode 100755
index 0000000..470a8ad
--- /dev/null
+++ b/hw-client/readProfile.py
@@ -0,0 +1,96 @@
+#!/usr/bin/python
+
+import hardware
+import sys
+import os
+import commands
+import re
+import urlgrabber.grabber
+
+try:
+ UUID = file('/etc/sysconfig/hw-uuid').read()
+except IOError:
+ try:
+ UUID = file('/proc/sys/kernel/random/uuid').read()
+ try:
+ file('/etc/sysconfig/hw-uuid', 'w').write(UUID)
+ except:
+ print 'couldn\'t write'
+ except IOError:
+ sys.stderr.write('Unable to determine UUID of system!\n')
+ sys.exit(1)
+
+hw = hardware.Hardware()
+lsbRelease = commands.getstatusoutput('/usr/bin/lsb_release')[1]
+
+try:
+ OS = file('/etc/redhat-release').read()
+except IOError:
+ OS = 'Unknown'
+
+initdefault_re = re.compile(r':(\d+):initdefault:')
+defaultRunlevel = 'Unknown'
+try:
+ inittab = file('/etc/inittab').read()
+ match = initdefault_re.search(inittab)
+ if match:
+ defaultRunlevel = match.group(1)
+except IOError:
+ sys.stderr.write('Unable to read /etc/inittab, continuing...')
+
+language = os.environ['LANG']
+
+platform = bogomips = CPUVendor = numCPUs = CPUSpeed = systemMemory = systemSwap = vendor = system = ''
+
+for device in hw:
+ try:
+ platform = device['platform']
+ bogomips = device['bogomips']
+ CPUVendor = "%s - %s" % (device['type'], device['model'])
+ numCPUs = device['count']
+ CPUSpeed = device['speed']
+ except:
+ pass
+ try:
+ systemMemory = device['ram']
+ systemSwap = device['swap']
+ except:
+ pass
+ try:
+ vendor = device['vendor']
+ system = device['system']
+ except:
+ pass
+
+
+
+print 'We would send the following information to the Fedora Smolt server:'
+print
+print '\tUUID: %s' % UUID
+print '\tlsbRelease: %s' % lsbRelease
+print '\tOS: %s' % OS
+print '\tdefaultRunlevel: %s' % defaultRunlevel
+print '\tlanguage: %s' % language
+print '\tplatform: %s' % platform
+print '\tbogomips: %s' % bogomips
+print '\tCPUVendor: %s' % CPUVendor
+print '\tnumCPUs: %s' % numCPUs
+print '\tCPUSpeed: %s' % CPUSpeed
+print '\tsystemMemory: %s' % systemMemory
+print '\tsystemSwap: %s' % systemSwap
+print '\tvendor: %s' % vendor
+print '\tsystem: %s' % system
+print
+print '\t\t Devices'
+print '\t\t================================='
+for device in hw:
+ try:
+ Bus = device['bus']
+ Driver = device['driver']
+ Class = device['class']
+ Description = device['desc']
+ except:
+ continue
+ else:
+ print '\t\t%s, %s, %s, %s' % (Bus, Driver, Class, Description)
+