Macjutsu / super

S.U.P.E.R.M.A.N. optimizes the macOS software update experience.
Apache License 2.0
634 stars 84 forks source link

Recheck deferral won't trigger upon Jamf connection failure #30

Closed iDrewbs closed 2 years ago

iDrewbs commented 2 years ago

I came across an issue where the super script failed to connect to my Jamf instance (Status: Jamf Pro service unavailable) and as a result the recheck deferral I have set did not trigger. I believe the expected behavior should be that the script should run again after the designated recheck deferral timeframe even in the event of a failure so the process can try again next time.

Below are log examples of a successful attempt, and the attempt where the Jamf Pro service was unavailable and the recheck deferral did not trigger

Mon Oct 10 09:53:05 ZG81939 super-starter[32829]: S.U.P.E.R.M.A.N. LAUNCHDAEMON Mon Oct 10 09:53:06 ZG81939 super[32836]: S.U.P.E.R.M.A.N. STARTER Mon Oct 10 09:53:06 ZG81939 super[32836]: Starter: Deleting previous LaunchDaemon com.macjutsu.super.plist. Mon Oct 10 09:53:06 ZG81939 super[32836]: Status: Current GUI user is andrewsp with a UID of 503. Mon Oct 10 09:53:08 ZG81939 super[32836]: Starter: Found saved credentials for super service account "super". Mon Oct 10 09:53:09 ZG81939 super[32836]: Starter: Validated saved credentials for super service account "super". Mon Oct 10 09:53:09 ZG81939 super[32836]: Starter: Found saved credentials for Jamf Pro API account "_Jamf_SuperAPI". Mon Oct 10 09:53:12 ZG81939 super[32836]: Starter: Validated saved credentials for Jamf Pro API account "_Jamf_SuperAPI". Mon Oct 10 09:53:12 ZG81939 super[32836]: Starter: Bootstrap token escrow validated. Mon Oct 10 09:53:12 ZG81939 super[32836]: S.U.P.E.R.M.A.N. STARTER END Mon Oct 10 09:53:12 ZG81939 super[32836]: S.U.P.E.R.M.A.N. UPDATE APPLE SILICON ASU SERVICE ACCOUNT Mon Oct 10 09:53:12 ZG81939 super[32836]: Status: Checking available Apple software updates... Mon Oct 10 09:53:20 ZG81939 super[32836]: Status: Double-checking available Apple software updates... Mon Oct 10 09:53:42 ZG81939 super[32836]: Status: No Apple software updates available. Some may be deferred via MDM. Mon Oct 10 09:53:42 ZG81939 super[32836]: Status: Recheck deferral should restart super in 3600 seconds. Mon Oct 10 09:53:42 ZG81939 super[32836]: Exit: LaunchDaemon com.macjutsu.super.plist is scheduled to start at 10:53 on 10/10. Mon Oct 10 09:53:43 ZG81939 super[32836]: S.U.P.E.R.M.A.N. EXIT Mon Oct 10 10:53:43 ZG81939 super-starter[33362]: S.U.P.E.R.M.A.N. LAUNCHDAEMON Mon Oct 10 10:53:43 ZG81939 super[33374]: S.U.P.E.R.M.A.N. STARTER Mon Oct 10 10:53:44 ZG81939 super[33374]: Starter: Deleting previous LaunchDaemon com.macjutsu.super.plist. Mon Oct 10 10:53:44 ZG81939 super[33374]: Status: Current GUI user is andrewsp with a UID of 503. Mon Oct 10 10:53:46 ZG81939 super[33374]: Starter: Found saved credentials for super service account "super". Mon Oct 10 10:53:47 ZG81939 super[33374]: Starter: Validated saved credentials for super service account "super". Mon Oct 10 10:53:47 ZG81939 super[33374]: Starter: Found saved credentials for Jamf Pro API account "_Jamf_SuperAPI". Mon Oct 10 10:53:48 ZG81939 super[33374]: Status: Jamf Pro service unavailable. Mon Oct 10 10:53:48 ZG81939 super[33374]: Exit: Unable to connect to Jamf Pro to validate user account. Mon Oct 10 10:53:48 ZG81939 super[33374]: S.U.P.E.R.M.A.N. EXIT

iDrewbs commented 2 years ago

It looks like the same thing happens if super is unable to parse the softwareupdate results. the recheck deferral won't be triggered. I'm guessing if any type of error causes the script to exit prematurely, the code to set the recheck deferral if that flag exsits is not being run. If a condition were added that upon exit, check if the recheck-deferral flag is set and schedule the LaunchDaemon. The line from super.log for this new scenario I found shows: Wed Oct 19 13:15:10 ZG13088 super[18769]: Exit: Unable to parse Apple softwareupdate results.

Macjutsu commented 2 years ago

This should be resolved with super v3.0b1. Thanks!