Skip to content

Commit

Permalink
Fix #74 (#110)
Browse files Browse the repository at this point in the history
* Anticipate a None result and ignore (and skip setting last_check

* Blacken
  • Loading branch information
sheagcraig authored Sep 21, 2023
1 parent af715df commit f99a4a0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 5 additions & 2 deletions payload/usr/local/sal/checkin_modules/apple_sus_checkin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion payload/usr/local/sal/checkin_modules/profile_checkin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit f99a4a0

Please sign in to comment.