From: Michael Tremer Date: Thu, 2 Dec 2010 20:45:28 +0000 (+0100) Subject: Concatenate several informations and build a new ID out of it. X-Git-Tag: v0.5~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ec65e26606fcaba124995ce49732dff8ac04317c;p=oddments%2Ffireinfo.git Concatenate several informations and build a new ID out of it. --- diff --git a/fireinfo/system.py b/fireinfo/system.py index 9ee82c5..bf2fb43 100644 --- a/fireinfo/system.py +++ b/fireinfo/system.py @@ -115,6 +115,9 @@ class System(object): "public_id" : self.public_id, "private_id" : self.private_id, + # XXX just for testing: + "secret_id" : self._unique_id, + # Actual profile data "profile" : p, } @@ -161,21 +164,20 @@ class System(object): None of the data here is ever sent to the server. """ - id = "" + ids = [] # Virtual machines (for example) and some boards have a UUID # which is globally unique. for file in ("product_uuid", "product_serial", "chassis_serial"): - id = read_from_file(os.path.join(SYS_CLASS_DMI, file)) - if id: - return id + id = read_from_file(os.path.join(SYS_CLASS_DMI, file)) or "" + ids.append(id) # As last resort, we use the UUID from pakfire. - id = read_from_file("/opt/pakfire/db/uuid") - if id: - return id + if not ids: + id = read_from_file("/opt/pakfire/db/uuid") or "" + ids.append(id) - return "" + return "#".join(ids) @property def language(self):