2424get_token () {
2525
2626 tokenFile=" $HOME /.blueXP_token"
27- tmpfile=$( mktemp -t get_token.XXXXXX)
28- trap ' rm -f "$tmpfile"' RETURN
2927
3028 if [ -z " $REFRESH_TOKEN " ]; then
3129 echo " Error: The REFRESH_TOKEN environment variable has not been set." >&2
@@ -55,14 +53,13 @@ get_token() {
5553 fi
5654
5755 if [ $createToken == " true" ]; then
58- curl -s -X POST ' https://netapp-cloud-account.auth0.com/oauth/token' \
56+ token= $( curl -s -X POST ' https://netapp-cloud-account.auth0.com/oauth/token' \
5957 -H ' Content-Type: application/json' \
6058 --data-raw ' {
6159 "grant_type": "refresh_token",
6260 "refresh_token": "' $REFRESH_TOKEN ' ",
6361 "client_id": "Mu0V1ywgYteI6w1MbD15fKfVIUrNXGWC"
64- }' > $tmpfile 2>&1
65- token=$( sed -ne ' s/."access_token":"\([^"]*\).*/\1/p' < $tmpfile )
62+ }' | sed -ne ' s/."access_token":"\([^"]*\).*/\1/p' )
6663
6764 if [ -z " $token " ]; then
6865 echo " Error: Unable to obtain a bearer token. Error message:" >&2
@@ -97,7 +94,13 @@ run_curl () {
9794 errorOutput=" $5 "
9895 data=" $6 "
9996 accept=" $7 "
100- shift 7
97+
98+ if [ -z " $accept " ]; then
99+ accept=" application/json, text/plain, */*"
100+ shift 6
101+ else
102+ shift 7
103+ fi
101104
102105 declare -a extraHeaders
103106 while [ $# -gt 0 ]; do
@@ -112,9 +115,6 @@ run_curl () {
112115 echo " Error: Missing required parameters for run_curl function." >&2
113116 exit 1
114117 fi
115- if [ -z " $accept " ]; then
116- accept=" application/json, text/plain, */*"
117- fi
118118 case " $method " in
119119 GET)
120120 curl -sw " %{stderr}%{http_code},%{errormsg}" " $url " \
0 commit comments