summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey <jcollie@fedoraproject.org>2007-01-23 00:19:24 (GMT)
committerYaakov M. Nemoy <loupgaroublond@gmail.com>2007-01-23 00:19:24 (GMT)
commit7572f1105c496dbd153a59622f7aa33d7e28e2a8 (patch)
tree5c2eb87b118d9d4d5e376c07f15c550e7384b6bb
parent172096937054124833e39793d7f2d56bd5c7154f (diff)
parentfe4e96e86f5db756fb0b165ee8baed5524ce2a2e (diff)
downloadsmolt-7572f1105c496dbd153a59622f7aa33d7e28e2a8.zip
smolt-7572f1105c496dbd153a59622f7aa33d7e28e2a8.tar.gz
smolt-7572f1105c496dbd153a59622f7aa33d7e28e2a8.tar.xz
Pulling in upstream changes
-rw-r--r--.hgsigs1
-rw-r--r--hardware/hardware/controllers.py112
-rw-r--r--hardware/hardware/model.py2
-rw-r--r--hardware/hardware/static/css/style.css26
-rw-r--r--hardware/hardware/static/images/dna-banner.pngbin12023 -> 0 bytes
-rw-r--r--hardware/hardware/static/images/tile.pngbin217 -> 0 bytes
-rw-r--r--hardware/hardware/templates/master.kid5
-rw-r--r--hardware/hardware/templates/master.pycbin6989 -> 7303 bytes
-rw-r--r--hardware/hardware/templates/stats.kid178
-rw-r--r--hardware/hardware/templates/stats.pycbin19788 -> 7746 bytes
-rw-r--r--hw-client/hardware.py44
-rwxr-xr-xhw-client/readProfile.py96
12 files changed, 57 insertions, 407 deletions
diff --git a/.hgsigs b/.hgsigs
new file mode 100644
index 0000000..ab00bca
--- /dev/null
+++ b/.hgsigs
@@ -0,0 +1 @@
+6f01938c34e05034bc82cd017cb4cf374c1ad9ef 0 iD8DBQBFr+Shrtk7xyyIQRERAsP0AJ9p80JKsvQiY4XAhjEVUuVv1+Op0QCfQpu3roF6LQyxuJhCKb8Jxd3UWTs=
diff --git a/hardware/hardware/controllers.py b/hardware/hardware/controllers.py
index 679acde..e6e8ecb 100644
--- a/hardware/hardware/controllers.py
+++ b/hardware/hardware/controllers.py
@@ -8,6 +8,13 @@ from hardware.model import Device
from hardware.model import HostLinks
from sqlobject import SQLObjectNotFound
+class statusBar:
+ def bar(num, tot):
+ for i in range (int( float(num) / tot * 50)):
+ print '|'
+
+
+
class Root(controllers.RootController):
@expose(template="hardware.templates.welcome")
def index(self):
@@ -18,47 +25,41 @@ class Root(controllers.RootController):
@expose(template="hardware.templates.add")
def add(self, UUID, lsbRelease, OS, platform, bogomips, systemMemory, systemSwap, CPUVendor, numCPUs, CPUSpeed, language, defaultRunlevel, vendor, system):
import time
- UUID = UUID.rstrip()
-
- try:
- Host._connection.queryAll("delete from host_links where host_u_u_id='%s'" % UUID)
- except:
- DoNothing = 1
try:
hostSQL = Host.byUUID(UUID)
- hostSQL.lsbRelease = lsbRelease.rstrip()
- hostSQL.OS = OS.rstrip()
- hostSQL.platform = platform.rstrip()
+ hostSQL.lsbRelease = lsbRelease
+ hostSQL.OS = OS
+ hostSQL.platform = platform
try:
hostSQL.bogomips = float(bogomips)
except:
hostSQL.bogomips = 0
hostSQL.systemMemory = int(systemMemory)
hostSQL.systemSwap = int(systemSwap)
- hostSQL.CPUVendor = CPUVendor.rstrip()
+ hostSQL.CPUVendor = CPUVendor
hostSQL.numCPUs = int(numCPUs)
- hostSQL.CPUSpeed = float(CPUSpeed)
- hostSQL.language = language.rstrip()
+ hostSQL.CPUSpeed = CPUSpeed
+ hostSQL.language = language
hostSQL.defaultRunlevel = int(defaultRunlevel)
- hostSQL.vendor = vendor.rstrip()
- hostSQL.system = system.rstrip()
+ hostSQL.vendor = vendor
+ hostSQL.system = system
except SQLObjectNotFound:
hostSQL = Host(UUID = UUID,
- lsbRelease = lsbRelease.rstrip(),
- OS = OS.rstrip(),
- platform = platform.rstrip(),
+ lsbRelease = lsbRelease,
+ OS = OS,
+ platform = platform,
bogomips = float(bogomips),
systemMemory = int(systemMemory),
systemSwap = int(systemSwap),
- CPUVendor = CPUVendor.rstrip(),
+ CPUVendor = CPUVendor,
numCPUs = int(numCPUs),
- CPUSpeed = float(CPUSpeed),
- language = language.rstrip(),
+ CPUSpeed = CPUSpeed,
+ language = language,
defaultRunlevel = int(defaultRunlevel),
- vendor = vendor.rstrip(),
- system = system.rstrip())
+ vendor = vendor,
+ system = system)
return dict(hostObject=hostSQL)
@@ -66,11 +67,6 @@ class Root(controllers.RootController):
def addDevice(self, UUID, Description, Bus, Driver, Class):
import time
from mx import DateTime
- UUID = UUID.rstrip()
- Description = Description.rstrip()
- Bus = Bus.rstrip()
- Driver = Driver.rstrip()
- Class = Class.rstrip()
try:
deviceSQL = Device.byDescription(Description)
@@ -99,69 +95,9 @@ class Root(controllers.RootController):
stats = {}
stats['archs'] = Host._connection.queryAll("Select platform, count(platform) as cnt from Host group by platform order by cnt desc")
stats['archstot'] = int(Host._connection.queryAll('select count(platform) from Host;')[0][0])
-
stats['OS'] = Host._connection.queryAll("Select o_s, count(o_s) as cnt from Host group by o_s order by cnt desc")
- stats['OStot'] = Host._connection.queryAll("Select count(o_s) from Host")[0][0]
-
stats['runlevel'] = Host._connection.queryAll("Select default_runlevel, count(default_runlevel) as cnt from Host group by default_runlevel order by cnt desc")
- stats['runleveltot'] = Host._connection.queryAll("Select count(default_runlevel) from Host")[0][0]
-
stats['devices'] = Host._connection.queryAll("select Device.description, count(host_links.device_id) as cnt from host_links, Device where host_links.Device_id=Device.id group by host_links.device_id order by cnt desc limit 20;")
- stats['devices20sum'] = Host._connection.queryAll("select count(*) as cnt from host_links, Device where host_links.Device_id=Device.id order by cnt desc limit 20;")[0][0]
- stats['devicestot'] = Host._connection.queryAll("Select count(*) from host_links")[0][0]
-
- stats['numCPUs'] = Host._connection.queryAll("Select num_cp_us, count(num_cp_us) as cnt from Host group by num_cp_us order by cnt desc")
- stats['numCPUstot'] = int(Host._connection.queryAll('Select count(num_cp_us) from Host;')[0][0])
-
- stats['cpuVendor'] = Host._connection.queryAll("Select cpu_vendor, count(cpu_vendor) as cnt from Host group by cpu_vendor order by cnt desc")
- stats['cpuVendortot'] = int(Host._connection.queryAll('Select count(cpu_vendor) from Host;')[0][0])
-
- stats['language'] = Host._connection.queryAll("Select language, count(language) as cnt from Host group by language order by cnt desc")
- stats['languagetot'] = int(Host._connection.queryAll('Select count(language) from Host;')[0][0])
-
- stats['sysMem'] = []
- stats['sysMem'].append(Host._connection.queryAll('select (select "< 512") as range, count(system_memory) as cnt from Host where system_memory <= 512')[0])
- stats['sysMem'].append(Host._connection.queryAll('select (select "513 - 1024") as range, count(system_memory) as cnt from Host where system_memory > 512 and system_memory <= 1024')[0])
- stats['sysMem'].append(Host._connection.queryAll('select (select "1025 - 2048") as range, count(system_memory) as cnt from Host where system_memory > 1025 and system_memory <= 2048')[0])
- stats['sysMem'].append(Host._connection.queryAll('select (select "> 2048") as range, count(system_memory) as cnt from Host where system_memory > 2048')[0])
-
- stats['swapMem'] = []
- stats['swapMem'].append(Host._connection.queryAll('select (select "< 512") as range, count(system_swap) as cnt from Host where system_swap <= 512')[0])
- stats['swapMem'].append(Host._connection.queryAll('select (select "513 - 1024") as range, count(system_swap) as cnt from Host where system_swap > 512 and system_swap <= 1024')[0])
- stats['swapMem'].append(Host._connection.queryAll('select (select "1025 - 2048") as range, count(system_swap) as cnt from Host where system_swap > 1025 and system_swap <= 2048')[0])
- stats['swapMem'].append(Host._connection.queryAll('select (select "> 2048") as range, count(system_swap) as cnt from Host where system_swap > 2048')[0])
-
- stats['cpuSpeed'] = []
- stats['cpuSpeed'].append(Host._connection.queryAll('select (select "=< 512") as range, count(cpu_speed) as cnt from Host where cpu_speed <= 512')[0])
- stats['cpuSpeed'].append(Host._connection.queryAll('select (select "513 - 1024") as range, count(cpu_speed) as cnt from Host where cpu_speed > 512 and cpu_speed <= 1024')[0])
- stats['cpuSpeed'].append(Host._connection.queryAll('select (select "1025 - 2048") as range, count(cpu_speed) as cnt from Host where cpu_speed > 1025 and cpu_speed <= 2048')[0])
- stats['cpuSpeed'].append(Host._connection.queryAll('select (select "> 2048") as range, count(cpu_speed) as cnt from Host where cpu_speed > 2048')[0])
-
- stats['bogomips'] = []
- stats['bogomips'].append(Host._connection.queryAll('select (select "=< 512") as range, count(bogomips) as cnt from Host where bogomips <= 512')[0])
- stats['bogomips'].append(Host._connection.queryAll('select (select "513 - 1024") as range, count(bogomips) as cnt from Host where bogomips > 512 and bogomips <= 1024')[0])
- stats['bogomips'].append(Host._connection.queryAll('select (select "1025 - 2048") as range, count(bogomips) as cnt from Host where bogomips > 1025 and bogomips <= 2048')[0])
- stats['bogomips'].append(Host._connection.queryAll('select (select "> 2048") as range, count(bogomips) as cnt from Host where bogomips > 2048')[0])
-
-
-
-# id INTEGER PRIMARY KEY,
-# u_u_id TEXT NOT NULL UNIQUE,
-# lsb_release TEXT,
-# o_s TEXT,
-# platform TEXT,
-# bogomips FLOAT,
-# system_memory INT,
-# system_swap INT,
-# vendor TEXT,
-# system TEXT,
-# cpu_vendor TEXT,
-# num_cp_us INT,
-# cpu_speed TEXT,
-# language TEXT,
-# default_runlevel INT
-
-
- return dict(Host=Host, Device=Device, HostLinks=HostLinks, Stat=stats)
+ return dict(Host=Host, Device=Device, HostLinks=HostLinks, Stat=stats, statusBar=statusBar)
diff --git a/hardware/hardware/model.py b/hardware/hardware/model.py
index 99143a7..9943024 100644
--- a/hardware/hardware/model.py
+++ b/hardware/hardware/model.py
@@ -31,7 +31,7 @@ class Host(SQLObject):
system = StringCol(title="Machine Model")
CPUVendor = StringCol(title="CPU Vendor")
numCPUs = IntCol(title="Number of CPUs")
- CPUSpeed = FloatCol(title="CPU Speed")
+ CPUSpeed = StringCol(title="CPU Speed")
language = StringCol(title="Language")
defaultRunlevel = IntCol(title="Default Runlevel")
diff --git a/hardware/hardware/static/css/style.css b/hardware/hardware/static/css/style.css
index 2dcc644..1bc7d64 100644
--- a/hardware/hardware/static/css/style.css
+++ b/hardware/hardware/static/css/style.css
@@ -5,15 +5,15 @@
html, body, th, td {
color: black;
background-color: #ddd;
- font: small "Lucida Grande", "Lucida Sans Unicode", geneva, verdana, sans-serif;
+ font: x-small "Lucida Grande", "Lucida Sans Unicode", geneva, verdana, sans-serif;
margin: 0;
padding: 0;
}
#header {
- height: 60px;
+ height: 80px;
width: 777px;
- background: #1956A3 URL('../images/dna-banner.png') no-repeat;
+ background: blue URL('../images/header_inner.png') no-repeat;
border-left: 1px solid #aaa;
border-right: 1px solid #aaa;
margin: 0 auto 0 auto;
@@ -122,23 +122,3 @@ span.code {
background: #eef URL('../images/info.png') left center no-repeat;
border: 1px solid #cce;
}
-
-#stats th{
- text-align: right;
- font-weight: bold;
- color: #072B61;
- padding: 5px 5px 5px 5px;
- background: #DDDDDD;
-}
-
-#stats td{
- padding: 5px;
- background: #EEEEEE;
-}
-
-#runLevelList, #osList, #devicesList{
- padding: 0px;
- margin: 2px;
- list-style: none;
-}
-
diff --git a/hardware/hardware/static/images/dna-banner.png b/hardware/hardware/static/images/dna-banner.png
deleted file mode 100644
index b8601e6..0000000
--- a/hardware/hardware/static/images/dna-banner.png
+++ /dev/null
Binary files differ
diff --git a/hardware/hardware/static/images/tile.png b/hardware/hardware/static/images/tile.png
deleted file mode 100644
index b597654..0000000
--- a/hardware/hardware/static/images/tile.png
+++ /dev/null
Binary files differ
diff --git a/hardware/hardware/templates/master.kid b/hardware/hardware/templates/master.kid
index c27d37e..f13dad6 100644
--- a/hardware/hardware/templates/master.kid
+++ b/hardware/hardware/templates/master.kid
@@ -38,13 +38,10 @@
<!-- End of main_content -->
</div>
-<div id="footer">
- <!--
- <img src="/static/images/under_the_hood_blue.png" alt="TurboGears under the hood" />
+<div id="footer"> <img src="/static/images/under_the_hood_blue.png" alt="TurboGears under the hood" />
<p>TurboGears is a open source front-to-back web development
framework written in Python</p>
<p>Copyright &copy; 2006 Kevin Dangoor</p>
- -->
</div>
</body>
diff --git a/hardware/hardware/templates/master.pyc b/hardware/hardware/templates/master.pyc
index 88a4165..2d521a5 100644
--- a/hardware/hardware/templates/master.pyc
+++ b/hardware/hardware/templates/master.pyc
Binary files differ
diff --git a/hardware/hardware/templates/stats.kid b/hardware/hardware/templates/stats.kid
index 839ab3c..39678b1 100644
--- a/hardware/hardware/templates/stats.kid
+++ b/hardware/hardware/templates/stats.kid
@@ -1,171 +1,41 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xmlns:py="http://purl.org/kid/ns#" py:extends="'master.kid'">
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:py="http://purl.org/kid/ns#"
+ py:extends="'master.kid'">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" py:replace="''"/>
<title> Stats </title>
</head>
<body>
- <table id="stats" width="100%" border="0" cellpadding="3" cellspacing="3">
- <tr>
- <th valign="top" width="25%">Total Registered Hosts</th>
- <td><strong>${Host.select('1=1').count()}</strong></td>
- </tr>
- <tr>
- <th valign="top">Total Registered Devices</th>
- <td><strong>${Device.select('1=1').count()}</strong></td>
- </tr>
-
- <tr>
- <th valign="top">Archs</th>
- <td>
- <table id="stats">
+ <table>
+ <tr><td>Total Registered Hosts</td><td>${Host.select('1=1').count()}</td></tr>
+ <tr><td>Total Registered Devices</td><td>${Device.select('1=1').count()}</td></tr>
+ <tr><td>Arch's</td>
+ <td>
+ <table>
<tr py:for='arch in Stat["archs"]'>
- <td align="right">${arch[0]}</td>
- <td align="center">${arch[1]}</td>
- <td><strong>${'%.1f' % (float(arch[1]) / Stat["archstot"] * 100) } %</strong></td>
- <td><img py:for='i in range(1, int( float(arch[1]) / Stat["archstot"] * 100 ))' src='/static/images/tile.png' /></td>
- </tr>
- </table>
- </td>
- </tr>
-
- <tr>
- <th valign="top">Operating Systems</th>
- <td>
- <table id="stats">
- <tr py:for='OS in Stat["OS"]'>
- <td align="right">${OS[0]}</td>
- <td align="center">${OS[1]}</td>
- <td><strong>${'%.1f' % (float(OS[1]) / Stat["OStot"] * 100) } %</strong></td>
- <td><img py:for='i in range(1, int( float(OS[1]) / Stat["OStot"] * 100 ))' src='/static/images/tile.png' /></td>
- </tr>
- </table>
- </td>
- </tr>
-
- <tr>
- <th valign="top">Default Runlevel</th>
- <td>
- <table id="stats">
- <tr py:for='rl in Stat["runlevel"]'>
- <td align="right">${rl[0]}</td>
- <td align="center">${rl[1]}</td>
- <td><strong>${'%.1f' % (float(rl[1]) / Stat["runleveltot"] * 100) } %</strong></td>
- <td><img py:for='i in range(1, int( float(rl[1]) / Stat["runleveltot"] * 100 ))' src='/static/images/tile.png' /></td>
- </tr>
- </table>
- </td>
- </tr>
-
- <tr>
- <th valign="top">Language</th>
- <td>
- <table id="stats">
- <tr py:for='lang in Stat["language"]'>
- <td align="right">${lang[0]}</td>
- <td align="center">${lang[1]}</td>
- <td><strong>${'%.1f' % (float(lang[1]) / Stat["languagetot"] * 100) } %</strong></td>
- <td><img py:for='i in range(1, int( float(lang[1]) / Stat["languagetot"] * 100 ))' src='/static/images/tile.png' /></td>
- </tr>
- </table>
- </td>
- </tr>
-
- <tr>
- <th valign="top">CPU Vendor</th>
- <td>
- <table id="stats">
- <tr py:for='cpuVen in Stat["cpuVendor"]'>
- <td align="right">${cpuVen[0]}</td>
- <td align="center">${cpuVen[1]}</td>
- <td><strong>${'%.1f' % (float(cpuVen[1]) / Stat["cpuVendortot"] * 100) } %</strong></td>
- <td><img py:for='i in range(1, int( float(cpuVen[1]) / Stat["cpuVendortot"] * 100 ))' src='/static/images/tile.png' /></td>
- </tr>
- </table>
- </td>
- </tr>
-
-
-
- <tr>
- <th valign="top">System Memory</th>
- <td>
- <table id="stats">
- <tr py:for='mem in Stat["sysMem"]'>
- <td align="right">${mem[0]}</td>
- <td align="center">${mem[1]}</td>
- <td><strong>${'%.1f' % (float(mem[1]) / Host.select('1=1').count() * 100) } %</strong></td>
- <td><img py:for='i in range(1, int( float(mem[1]) / Host.select("1=1").count() * 100 ))' src='/static/images/tile.png' /></td>
+ <td>${arch[0]}</td><td>${arch[1]} </td><td><b py:for='i in range(1, int( float(arch[1]) / Stat["archstot"] * 50 ))'>|</b></td><td>${'%.1f' % (float(arch[1]) / Stat["archstot"] * 100) } %</td>
</tr>
</table>
</td>
</tr>
- <tr>
- <th valign="top">Swap Memory</th>
- <td>
- <table id="stats">
- <tr py:for='mem in Stat["swapMem"]'>
- <td align="right">${mem[0]}</td>
- <td align="center">${mem[1]}</td>
- <td><strong>${'%.1f' % (float(mem[1]) / Host.select('1=1').count() * 100) } %</strong></td>
- <td><img py:for='i in range(1, int( float(mem[1]) / Host.select("1=1").count() * 100 ))' src='/static/images/tile.png' /></td>
- </tr>
- </table>
- </td>
- </tr>
+ <tr><td>Operating Systems</td><td>
+ <div py:for='OS in Stat["OS"]'>
+ ${OS[0]}: ${OS[1]}<br/>
+ </div>
+ </td></tr>
+ <tr><td>Default Runlevel</td><td>
+ <div py:for='rl in Stat["runlevel"]'>
+ (${rl[0]}): ${rl[1]}<br/>
+ </div>
+ </td></tr>
+ <tr><td>Top 20 Devices</td><td>
+ <div py:for='dev in Stat["devices"]'>
+ ${dev[0]}: ${dev[1]}<br/>
+ </div>
+ </td></tr>
- <tr>
- <th>CPU Speed</th>
- <td>
- <table id="stats">
- <tr py:for='cpuSpeed in Stat["cpuSpeed"]'>
- <td align="right">${cpuSpeed[0]}</td>
- <td align="center">${cpuSpeed[1]}</td>
- <td><strong>${'%.1f' % (float(cpuSpeed[1]) / Host.select('1=1').count() * 100) } %</strong></td>
- <td><img py:for='i in range(1, int( float(cpuSpeed[1]) / Host.select("1=1").count() * 100 ))' src='/static/images/tile.png' /></td>
- </tr>
- </table>
- </td>
- </tr>
-
- <tr>
- <th>bogomips</th>
- <td>
- <table id="stats">
- <tr py:for='bogomips in Stat["bogomips"]'>
- <td align="right">${bogomips[0]}</td>
- <td align="center">${bogomips[1]}</td>
- <td><strong>${'%.1f' % (float(bogomips[1]) / Host.select('1=1').count() * 100) } %</strong></td>
- <td><img py:for='i in range(1, int( float(bogomips[1]) / Host.select("1=1").count() * 100 ))' src='/static/images/tile.png' /></td>
- </tr>
- </table>
- </td>
- </tr>
-
-
-
- <tr>
- <th valign="top">Top 20 Devices</th>
- <td>
- <table id="stats">
- <tr py:for='dev in Stat["devices"]'>
- <td align="right">${dev[0]}</td>
- <td align="center">${dev[1]}</td>
- <td nowrap="true"><strong>${'%.1f' % (float(dev[1]) / Stat["devicestot"] * 100) } %</strong></td>
- <td nowrap="true"><img py:for='i in range(1, int( float(dev[1]) / Stat["devicestot"] * 100 ))' src='/static/images/tile.png' /></td>
- </tr>
- <!--<tr>
- <td align="right">Other</td>
- <td align="center"></td>
- <td nowrap="true"><strong>${'%.1f' % (float(Stat["devices20sum"]) / Stat["devicestot"] * 100) } %</strong></td>
- <td><img py:for='i in range(1, int( float(Stat["devices20sum"]) / Stat["devicestot"] * 100 ))' src='/static/images/tile.png' /></td>
- </tr>-->
- </table>
- </td>
- </tr>
-
</table>
</body>
</html>
diff --git a/hardware/hardware/templates/stats.pyc b/hardware/hardware/templates/stats.pyc
index e6cfc60..58ee54a 100644
--- a/hardware/hardware/templates/stats.pyc
+++ b/hardware/hardware/templates/stats.pyc
Binary files differ
diff --git a/hw-client/hardware.py b/hw-client/hardware.py
index 31c238a..5c3a309 100644
--- a/hw-client/hardware.py
+++ b/hw-client/hardware.py
@@ -387,6 +387,7 @@ def read_cpuinfo():
# class, desc (required to identify the hardware device)
# count, type, model, model_number, model_ver, model_rev
# bogomips, platform, speed, cache
+
hwdict = { 'class': "CPU",
"desc" : "Processor",
}
@@ -501,7 +502,7 @@ def read_cpuinfo():
hwdict['speed'] = -1
hwdict['other'] = get_entry(tmpdict, 'features')
- elif uname in ['ppc64','ppc']:
+ elif uname in ['ppc64']:
tmpdict = {}
count = 0
for cpu in string.split(cpulist, "\n\n"):
@@ -527,53 +528,14 @@ def read_cpuinfo():
hwdict['model_ver'] = get_entry(tmpdict, 'revision')
hwdict['bogomips'] = get_entry(tmpdict, 'bogomips')
hwdict['vendor'] = get_entry(tmpdict, 'machine')
- hwdict['type'] = get_entry(tmpdict, 'platform')
- hwdict['system'] = get_entry(tmpdict, 'detected as')
# strings are postpended with "mhz"
mhz_speed = get_entry(tmpdict, 'clock')[:-3]
try:
hwdict['speed'] = int(round(float(mhz_speed)) - 1)
except ValueError:
hwdict['speed'] = -1
-
- elif uname in ["sparc64","sparc"]:
- tmpdict = {}
- bogomips = 0
- for cpu in string.split(cpulist, "\n\n"):
- if not len(cpu):
- continue
-
- for cpu_attr in string.split(cpu, "\n"):
- if not len(cpu_attr):
- continue
- vals = string.split(cpu_attr, ":")
- if len(vals) != 2:
- # XXX: make at least some effort to recover this data...
- continue
- name, value = string.strip(vals[0]), string.strip(vals[1])
- if name.endswith('Bogo'):
- if bogomips == 0:
- bogomips = int(round(float(value)) )
- continue
- continue
- tmpdict[string.lower(name)] = string.lower(value)
- system = ''
- if not os.access("/proc/openprom/banner-name", os.R_OK):
- system = 'Unknown'
- if os.access("/proc/openprom/banner-name", os.R_OK):
- system = open("/proc/openprom/banner-name", "r").read()
- hwdict['platform'] = uname
- hwdict['count'] = get_entry(tmpdict, 'ncpus probed')
- hwdict['model'] = get_entry(tmpdict, 'cpu')
- hwdict['type'] = get_entry(tmpdict, 'type')
- hwdict['model_ver'] = get_entry(tmpdict, 'type')
- hwdict['bogomips'] = bogomips
- hwdict['vendor'] = 'sun'
- hwdict['cache'] = "" # pitty the kernel doesn't tell us this.
- speed = int(round(float(bogomips))) / 2
- hwdict['speed'] = speed
- hwdict['system'] = system
+
else:
# XXX: expand me. Be nice to others
hwdict['platform'] = uname
diff --git a/hw-client/readProfile.py b/hw-client/readProfile.py
deleted file mode 100755
index 470a8ad..0000000
--- a/hw-client/readProfile.py
+++ /dev/null
@@ -1,96 +0,0 @@
-#!/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)
-