This returns a globally (hopefully) ID to identify the host
later (by request) in the database.
"""
- return hashlib.sha1(self._unique_id).hexdigest()
-
+ public_id = self._unique_id
+ if not public_id:
+ return "0" * 40
+
+ return hashlib.sha1(public_id).hexdigest()
+
@property
def private_id(self):
"""
for i in reversed(self._unique_id):
private_id += i
+ if not private_id:
+ return "0" * 40
+
return hashlib.sha1(private_id).hexdigest()
@property
None of the data here is ever sent to the server.
"""
- return "123456789" # XXX just a dummy
+ id = ""
+
+ # 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
+
+ # As last resort, we use the UUID from pakfire.
+ id = read_from_file("/opt/pakfire/db/uuid")
+ if id:
+ return id
+
+ return ""
@property
def language(self):