smolt/smolt-1.4.3-el5.patch

105 lines
4.7 KiB
Diff
Raw Normal View History

diff -ruN smolt-1.4.3.el5/client/smolt.py smolt-1.4.3/client/smolt.py
--- smolt-1.4.3.el5/client/smolt.py 2010-02-27 12:05:44.000000000 -0700
+++ smolt-1.4.3/client/smolt.py 2010-03-03 17:37:30.000000000 -0700
@@ -35,6 +35,7 @@
import dbus
import software
import os
+import commands
import urlgrabber.grabber
import sys
from urlparse import urljoin
@@ -436,6 +437,57 @@
if Gate().grants('devices'):
self.devices[udi] = Device(props, self)
if udi == '/org/freedesktop/Hal/devices/computer':
+ try:
+ vendor = props['system.vendor']
+ if len(vendor.strip()) == 0:
+ vendor = None
+ except KeyError:
+ try:
+ vendor = props['vendor']
+ if len(vendor.strip()) == 0:
+ vendor = None
+ except KeyError:
+ vendor = None
+ try:
+ product = props['system.product']
+ if len(product.strip()) == 0:
+ product = None
+ except KeyError:
+ try:
+ product = props['product']
+ if len(product.strip()) == 0:
+ product = None
+ except KeyError:
+ product = None
+ if vendor is None or product is None:
+ i, dmiOutput, e = os.popen3("/usr/sbin/dmidecode", "r")
+ section = None
+ sysvendor = None
+ sysproduct = None
+ boardvendor = None
+ boardproduct = None
+ for line in dmiOutput:
+ line = line.strip()
+ if "Information" in line:
+ section = line
+ elif section is None:
+ continue
+ elif line.startswith("Manufacturer: ") and section.startswith("System"):
+ sysvendor = line.split("Manufacturer: ", 1)[1]
+ elif line.startswith("Product Name: ") and section.startswith("System"):
+ sysproduct = line.split("Product Name: ", 1)[1]
+ elif line.startswith("Manufacturer: ") and section.startswith("Base Board"):
+ boardvendor = line.split("Manufacturer: ", 1)[1]
+ elif line.startswith("Product Name: ") and section.startswith("Base Board"):
+ boardproduct = line.split("Product Name: ", 1)[1]
+ status = dmiOutput.close()
+ if status is None:
+ if sysvendor not in (None, 'System Manufacturer') and sysproduct not in (None, 'System Name'):
+ props['system.vendor'] = sysvendor
+ props['system.product'] = sysproduct
+ elif boardproduct is not None and boardproduct is not None:
+ props['system.vendor'] = boardvendor
+ props['system.product'] = boardproduct
self.host = Host(props)
self.fss = get_file_systems()
@@ -515,14 +567,14 @@
def write_pub_uuid(self,smoonURL,pub_uuid):
smoonURLparsed=urlparse(smoonURL)
try:
- UuidDb().set_pub_uuid(getUUID(), smoonURLparsed.hostname, pub_uuid)
+ UuidDb().set_pub_uuid(getUUID(), smoonURLparsed[1], pub_uuid)
except Exception, e:
sys.stderr.write(_('\tYour pub_uuid could not be written.\n\n'))
return
def write_admin_token(self,smoonURL,admin,admin_token_file):
smoonURLparsed=urlparse(smoonURL)
- admin_token_file += ("-"+smoonURLparsed.hostname)
+ admin_token_file += ("-"+smoonURLparsed[1])
try:
file(admin_token_file, 'w').write(admin)
except Exception, e:
@@ -1211,7 +1263,7 @@
def getPubUUID(user_agent=user_agent, smoonURL=smoonURL, timeout=timeout):
smoonURLparsed=urlparse(smoonURL)
- res = UuidDb().get_pub_uuid(getUUID(), smoonURLparsed.hostname)
+ res = UuidDb().get_pub_uuid(getUUID(), smoonURLparsed[1])
if res:
return res
@@ -1220,7 +1272,7 @@
o = grabber.urlopen(urljoin(smoonURL + "/", '/client/pub_uuid/%s' % getUUID()))
pudict = simplejson.loads(o.read())
o.close()
- UuidDb().set_pub_uuid(getUUID(), smoonURLparsed.hostname, pudict["pub_uuid"])
+ UuidDb().set_pub_uuid(getUUID(), smoonURLparsed[1], pudict["pub_uuid"])
return pudict["pub_uuid"]
except Exception, e:
error(_('Error determining public UUID: %s') % e)