Skip to content

Commit

Permalink
Throw error if OpenStack error code returned from API
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshuaSBrown committed Jan 16, 2025
1 parent 39814b4 commit 443ee5f
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions scripts/ci_pipeline_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ Help()
echo "-a, --gitlab-api-token The GitLab API token for checking the"
echo " status of a pipeline."
}

GITLAB_PROJECT_ID="10830"

OS_APP_ID=$(printenv OS_APP_ID || true)
Expand Down Expand Up @@ -145,7 +144,7 @@ data=$(curl -s --retry 5 -i -X POST \
}
}" \
https://orc-open.ornl.gov:13000/v3/auth/tokens)
error_code=$?
error_code="$?"
if [ "$error_code" == "6" ]
then
echo "Unable to connect to Open Stack API endpoints, make sure you are"
Expand Down Expand Up @@ -226,17 +225,20 @@ find_orc_instance_by_name() {
found_vm_id="TRUE"
fi
}
body=$(echo "$data" | sed -n 's/^\({\".*\)/\1/p')

body=$(echo $data | sed 's/^.*{\"token/{\"token/' )
if jq -e 'has("error")' <<< "$body" > /dev/null; then
echo "Error Detected!"
echo "$body" | jq
exit 2
fi

compute_url=$(echo "$body" | jq '.token.catalog[] | select(.name=="nova") |.endpoints[] | select(.interface=="public") | .url ')
sanitize_compute_url=$(echo $compute_url | sed 's/\"//g')
header=$(echo "$data" | sed 's/{\"token.*//')
subject_token=$(echo "$data" | grep "X-Subject-Token" | awk '{print $2}' )

sanitize_subject_token=${subject_token:0:268}


################################################################################
# Check 1 - Are there running pipelines
################################################################################
Expand Down

0 comments on commit 443ee5f

Please sign in to comment.