Sentry: Handle unofficial device dongle id

This commit is contained in:
Jason Wen
2023-12-24 16:41:39 +00:00
parent 488f3647d9
commit 1c662ff310
2 changed files with 9 additions and 1 deletions
+6
View File
@@ -155,6 +155,12 @@ def manager_init() -> None:
else:
serial = params.get("HardwareSerial")
raise Exception(f"Registration failed for device {serial}")
if params.get("HardwareSerial") is None:
try:
serial = HARDWARE.get_serial()
params.put("HardwareSerial", serial)
except Exception:
cloudlog.exception("Error getting serial for device")
os.environ['DONGLE_ID'] = dongle_id # Needed for swaglog
if not is_dirty():
+3 -1
View File
@@ -97,7 +97,9 @@ def get_properties() -> Tuple[str, str]:
params = Params()
dongle_id = params.get("DongleId", encoding='utf-8')
if dongle_id in (None, UNREGISTERED_DONGLE_ID):
dongle_id = UNREGISTERED_DONGLE_ID
hardware_serial = params.get("HardwareSerial", encoding='utf-8')
hardware_serial = "" if hardware_serial is None else hardware_serial
dongle_id = UNREGISTERED_DONGLE_ID + hardware_serial
gitname = params.get("GithubUsername", encoding='utf-8')
if gitname is None:
gitname = ""