Skip to content

Commit

Permalink
check if token contains bearer header or not
Browse files Browse the repository at this point in the history
  • Loading branch information
pkrishn1-pk authored Mar 3, 2020
1 parent c33ffdd commit e00cd1f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion scripts/delete_custom_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,13 @@ function delete_image() {
_log "## Entering function: ${FUNCNAME[0]}"
# Command to delete Custom Image from user account.
# IC_IAM_TOKEN - Provided by IBM Cloud Schematics
token=$IC_IAM_TOKEN
if [[ $token != Bearer* ]]; then
token="Bearer "$token
fi
curl -X DELETE \
"$rias_endpoint/v1/images/$custom_image_id?version=2020-01-28&generation=2" \
-H "Authorization: Bearer $IC_IAM_TOKEN" &> "$MSG_FILE"
-H "Authorization: $token" &> "$MSG_FILE"
_log "## Exiting function: ${FUNCNAME[0]}"
}

Expand Down

0 comments on commit e00cd1f

Please sign in to comment.