dan-snelson / dialog-scripts

Scripts with leverage Bart Reardon's swiftDialog
MIT License
110 stars 35 forks source link

help with jamf policy -event #25

Closed CC007W closed 1 year ago

CC007W commented 1 year ago

Hello, First thank you for this. We are in the testing/pilot stages of mac rollout. I have been testing the script however, I have run into so troubles with using the custom event triggers.

Im editing this line:

 {
            "listitem": "Software",
            "icon": "99",
            "progresstext": "Please wait",
            "trigger_list": [
                {
                    "trigger": "working",
                    "path": "/Applications/Software/Test.app/Contents/Info.plist"
                }
            ]
        }

When I run Setup Your Mac from Self Service it fails instantly. 2022-12-22 09:00:00 - SETUP YOUR MAC DIALOG: listitem: index: 0, status: fail, statustext: Failed

However on the same macbook from Terminal. This works fine and installs the package sudo /usr/local/bin/jamf policy -event working

Is there something obvious I'm missing here?

dan-snelson commented 1 year ago

Thanks for reaching out, @CC007W, and sorry to hear that your mileage is varying too greatly.

Please confirm that policy_array is valid JSON; see the last bullet of Step E.2.3.2.

dan-snelson commented 1 year ago

(You're also invited to join us on the #setup-your-mac Mac Admins Slack Channel.)

CC007W commented 1 year ago

Hello, Yes I did test everything in policy array and came back as Valid JSON

dan-snelson commented 1 year ago

Thanks for validating.

I’m Terminal, when you run … sudo /usr/local/bin/jamf policy -event working

… does it actually install: "/Applications/Software/Test.app/Contents/Info.plist"

If not, that’s what’s “failing.”

CC007W commented 1 year ago

Thanks for validating.

I’m Terminal, when you run … sudo /usr/local/bin/jamf policy -event working

… does it actually install: "/Applications/Software/Test.app/Contents/Info.plist"

If not, that’s what’s “failing.”

Yes once I run in Terminal that path is now there because I tried Setup your Mac after using terminal and I get an instant Installed message

dan-snelson commented 1 year ago

Interesting …

… is it a timing issue on the first execution?

(Setup Your Mac isn’t doing anything special to see if the file exists.)

dan-snelson commented 1 year ago

You may wish to try 1.6.0-rc9 with a validation of None.

dan-snelson commented 1 year ago

Greetings, @CC007W!

Please advise the current status.

Thanks.

CC007W commented 1 year ago

Hello, I tried using 1.6.0 with validation of None . The status immediately shows installed however, the package is never installed. I also tried moving down in order with no luck. Its as if jamf policy -event never kicks off

dan-snelson commented 1 year ago

Thanks for the update, @CC007W.

Will you please direct-message me the logs on the Mac Admins Slack?

dan-snelson commented 1 year ago

Closing-the-loop for any other affected admins:

  • Enhanced policy logging options
    • Search for and comment-out: eval "${jamfBinary} policy -trigger ${trigger}"
    • Uncomment: eval "${jamfBinary} policy -trigger ${trigger} -verbose | tee -a ${scriptLog}"
    • Ensure debug mode is set to false
CC007W commented 1 year ago

This solved my issue. Ensure debug mode is set to false (since policies do not actually execute when debug mode is set to true)