In some of my workflows, I check the return code from a policy that is executed before continuing. If the policy fails, it will attempt to run the policy again, etc. Here are a couple of examples of how I check the return code:
# Example 1:
for ((i=0; i<=3; i++)); do
if /usr/local/jamf/bin/jamf policy -event "$event"; then
echo "Success"
break
else
echo "Failure"
fi
done
# Example 2:
/usr/local/jamf/bin/jamf policy -event "$event"
[ "$?" != "0" ] && echo "Error"
I have been using these techniques for quite a while with no issue, but just recently the policies that check the return code of a policy are reporting failure code 1 even though they appear to complete successfully in every other way. E.g. they show having completed successfully in Jamf Pro, the packages/scripts run by the policies complete without error, etc. I have even tried running some of my policies manually from the command line and checking the return code as in the examples below, and they are all returning 1 now.
jamf policy -event testPolicy; echo $?
jamf policy -id 1234; echo $?
I am curious if anyone has run into this or if they have any idea what could be causing this. I know that under the jamf help for the policy verb, there are several different return codes documented, but 1 is not on that list, so I just assume it is a typical failing like you would get from any other similar thing.