1 |
diff -ruN smolt-1.4.3.el5/client/smolt.py smolt-1.4.3/client/smolt.py |
2 |
--- smolt-1.4.3.el5/client/smolt.py 2010-02-27 12:05:44.000000000 -0700 |
3 |
+++ smolt-1.4.3/client/smolt.py 2010-03-03 17:37:30.000000000 -0700 |
4 |
@@ -35,6 +35,7 @@ |
5 |
import dbus |
6 |
import software |
7 |
import os |
8 |
+import commands |
9 |
import urlgrabber.grabber |
10 |
import sys |
11 |
from urlparse import urljoin |
12 |
@@ -436,6 +437,57 @@ |
13 |
if Gate().grants('devices'): |
14 |
self.devices[udi] = Device(props, self) |
15 |
if udi == '/org/freedesktop/Hal/devices/computer': |
16 |
+ try: |
17 |
+ vendor = props['system.vendor'] |
18 |
+ if len(vendor.strip()) == 0: |
19 |
+ vendor = None |
20 |
+ except KeyError: |
21 |
+ try: |
22 |
+ vendor = props['vendor'] |
23 |
+ if len(vendor.strip()) == 0: |
24 |
+ vendor = None |
25 |
+ except KeyError: |
26 |
+ vendor = None |
27 |
+ try: |
28 |
+ product = props['system.product'] |
29 |
+ if len(product.strip()) == 0: |
30 |
+ product = None |
31 |
+ except KeyError: |
32 |
+ try: |
33 |
+ product = props['product'] |
34 |
+ if len(product.strip()) == 0: |
35 |
+ product = None |
36 |
+ except KeyError: |
37 |
+ product = None |
38 |
+ if vendor is None or product is None: |
39 |
+ i, dmiOutput, e = os.popen3("/usr/sbin/dmidecode", "r") |
40 |
+ section = None |
41 |
+ sysvendor = None |
42 |
+ sysproduct = None |
43 |
+ boardvendor = None |
44 |
+ boardproduct = None |
45 |
+ for line in dmiOutput: |
46 |
+ line = line.strip() |
47 |
+ if "Information" in line: |
48 |
+ section = line |
49 |
+ elif section is None: |
50 |
+ continue |
51 |
+ elif line.startswith("Manufacturer: ") and section.startswith("System"): |
52 |
+ sysvendor = line.split("Manufacturer: ", 1)[1] |
53 |
+ elif line.startswith("Product Name: ") and section.startswith("System"): |
54 |
+ sysproduct = line.split("Product Name: ", 1)[1] |
55 |
+ elif line.startswith("Manufacturer: ") and section.startswith("Base Board"): |
56 |
+ boardvendor = line.split("Manufacturer: ", 1)[1] |
57 |
+ elif line.startswith("Product Name: ") and section.startswith("Base Board"): |
58 |
+ boardproduct = line.split("Product Name: ", 1)[1] |
59 |
+ status = dmiOutput.close() |
60 |
+ if status is None: |
61 |
+ if sysvendor not in (None, 'System Manufacturer') and sysproduct not in (None, 'System Name'): |
62 |
+ props['system.vendor'] = sysvendor |
63 |
+ props['system.product'] = sysproduct |
64 |
+ elif boardproduct is not None and boardproduct is not None: |
65 |
+ props['system.vendor'] = boardvendor |
66 |
+ props['system.product'] = boardproduct |
67 |
self.host = Host(props) |
68 |
|
69 |
self.fss = get_file_systems() |
70 |
@@ -515,14 +567,14 @@ |
71 |
def write_pub_uuid(self,smoonURL,pub_uuid): |
72 |
smoonURLparsed=urlparse(smoonURL) |
73 |
try: |
74 |
- UuidDb().set_pub_uuid(getUUID(), smoonURLparsed.hostname, pub_uuid) |
75 |
+ UuidDb().set_pub_uuid(getUUID(), smoonURLparsed[1], pub_uuid) |
76 |
except Exception, e: |
77 |
sys.stderr.write(_('\tYour pub_uuid could not be written.\n\n')) |
78 |
return |
79 |
|
80 |
def write_admin_token(self,smoonURL,admin,admin_token_file): |
81 |
smoonURLparsed=urlparse(smoonURL) |
82 |
- admin_token_file += ("-"+smoonURLparsed.hostname) |
83 |
+ admin_token_file += ("-"+smoonURLparsed[1]) |
84 |
try: |
85 |
file(admin_token_file, 'w').write(admin) |
86 |
except Exception, e: |
87 |
@@ -1211,7 +1263,7 @@ |
88 |
|
89 |
def getPubUUID(user_agent=user_agent, smoonURL=smoonURL, timeout=timeout): |
90 |
smoonURLparsed=urlparse(smoonURL) |
91 |
- res = UuidDb().get_pub_uuid(getUUID(), smoonURLparsed.hostname) |
92 |
+ res = UuidDb().get_pub_uuid(getUUID(), smoonURLparsed[1]) |
93 |
if res: |
94 |
return res |
95 |
|
96 |
@@ -1220,7 +1272,7 @@ |
97 |
o = grabber.urlopen(urljoin(smoonURL + "/", '/client/pub_uuid/%s' % getUUID())) |
98 |
pudict = simplejson.loads(o.read()) |
99 |
o.close() |
100 |
- UuidDb().set_pub_uuid(getUUID(), smoonURLparsed.hostname, pudict["pub_uuid"]) |
101 |
+ UuidDb().set_pub_uuid(getUUID(), smoonURLparsed[1], pudict["pub_uuid"]) |
102 |
return pudict["pub_uuid"] |
103 |
except Exception, e: |
104 |
error(_('Error determining public UUID: %s') % e) |