Skip to content

Commit 061b172

Browse files
committed
(PA-7586) Handle failed authentication
Since wget and curl may attempt to use credentials, report if authentication fails.
1 parent 224bb06 commit 061b172

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tasks/install_shell.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,13 @@ do_wget() {
402402
unable_to_retrieve_package
403403
fi
404404

405+
# check for 401
406+
grep "ERROR 401" $tmp_stderr 2>&1 >/dev/null
407+
if test $? -eq 0; then
408+
critical "ERROR 401"
409+
unable_to_retrieve_package
410+
fi
411+
405412
# check for bad return status or empty output
406413
if test $rc -ne 0 || test ! -s "$2"; then
407414
capture_tmp_stderr "wget"
@@ -428,6 +435,13 @@ do_curl() {
428435
unable_to_retrieve_package
429436
fi
430437

438+
# check for 401
439+
grep "401 Unauthorized" $tmp_stderr 2>&1 >/dev/null
440+
if test $? -eq 0; then
441+
critical "ERROR 401"
442+
unable_to_retrieve_package
443+
fi
444+
431445
# check for bad return status or empty output
432446
if test $rc -ne 0 || test ! -s "$2"; then
433447
capture_tmp_stderr "curl"

0 commit comments

Comments
 (0)