couple fixes for running a process model from script w/ burnettk

This commit is contained in:
jasquat 2023-03-24 12:09:27 -04:00
parent 5a4b60378d
commit 199cf05960
No known key found for this signature in database
1 changed files with 2 additions and 2 deletions

View File

@ -30,7 +30,7 @@ modified_process_model_identifier=$(tr '/' ':' <<<"$process_model_identifier")
function check_result_for_error() {
local result="$1"
error_code=$(jq '.error_code' <<<"$result")
if [[ -n "$error_code" ]]; then
if [[ -n "$error_code" && "$error_code" != "null" ]]; then
>&2 echo "ERROR: Failed to run process instance. Received error: $result"
exit 1
fi
@ -58,7 +58,7 @@ function process_next_task() {
access_token=$("${script_dir}/get_token" "$username" "$password" "$realm_name")
curl --silent -X POST "${BACKEND_BASE_URL}/v1.0/login_with_access_token?access_token=${access_token}" -H "Authorization: Bearer $access_token" >/dev/null
result=$(curl --silent -X POST "${BACKEND_BASE_URL}/v1.0/process-instances/${modified_process_model_identifier}" -H "Authorization: Bearer $access_token")
process_instance_id=$(jq '.id' <<<"$result")
process_instance_id=$(jq -r '.id' <<<"$result")
if ! grep -qE '^[0-9]+$' <<<"$process_instance_id"; then
>&2 echo "ERROR: Did not receive valid process instance id when instantiating process model. result was ${result}"
exit 1