From f99a4a001c02da05e75bef8d72ff534eb2305495 Mon Sep 17 00:00:00 2001 From: Shea Craig Date: Thu, 21 Sep 2023 14:28:06 -0400 Subject: [PATCH] Fix #74 (#110) * Anticipate a None result and ignore (and skip setting last_check * Blacken --- payload/usr/local/sal/checkin_modules/apple_sus_checkin.py | 7 +++++-- payload/usr/local/sal/checkin_modules/profile_checkin.py | 4 +++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/payload/usr/local/sal/checkin_modules/apple_sus_checkin.py b/payload/usr/local/sal/checkin_modules/apple_sus_checkin.py index ab350b2..91b6d51 100755 --- a/payload/usr/local/sal/checkin_modules/apple_sus_checkin.py +++ b/payload/usr/local/sal/checkin_modules/apple_sus_checkin.py @@ -67,11 +67,14 @@ def get_sus_facts(): install_log = handle.readlines() for line in reversed(install_log): - # TODO: Stop if we go before the subprocess call datetime-wise if "Catalog: http" in line and "catalog" not in result: result["catalog"] = line.split()[-1] elif "SUScan: Elapsed scan time = " in line and "last_check" not in result: - result["last_check"] = _get_log_time(line).isoformat() + try: + result["last_check"] = _get_log_time(line).isoformat() + except AttributeError: + # _get_log_time returned None + pass if (log_time := _get_log_time(line)) and log_time < history_limit: # Let's not look earlier than when we started diff --git a/payload/usr/local/sal/checkin_modules/profile_checkin.py b/payload/usr/local/sal/checkin_modules/profile_checkin.py index 14ad354..0be1883 100755 --- a/payload/usr/local/sal/checkin_modules/profile_checkin.py +++ b/payload/usr/local/sal/checkin_modules/profile_checkin.py @@ -28,7 +28,9 @@ def main(): for count, payload in enumerate(payloads, start=1): data[f"payload {count}"] = payload - data["payload_types"] = ", ".join(p.get("PayloadType", "None") for p in payloads) + data["payload_types"] = ", ".join( + p.get("PayloadType", "None") for p in payloads + ) data["profile_description"] = profile.get("ProfileDescription", "None") data["identifier"] = profile["ProfileIdentifier"] data["organization"] = profile.get("ProfileOrganization" or "None")