Output a slightly more helpful error if wget fails, and fix ignored --secure flag. #1

Merged
merged 2 commits into from Apr 28, 2012
@@ -185,10 +185,21 @@ get_status() {
if [ "$secure" = 1 ]
then
wget_opts="-O- -q -t 3 -T 3 --no-check-certificate"
- out=`wget ${wget_opts} http://${hostname}:${port}/${status_page}`
+ scheme="https://"
else
wget_opts="-O- -q -t 3 -T 3"
- out=`wget ${wget_opts} http://${hostname}:${port}/${status_page}`
+ scheme="http://"
+ fi
+
+ out=$(wget ${wget_opts} ${scheme}${hostname}:${port}/${status_page})
+
+ if [ $? -ne 0 ]
+ then
+ # Wording this error is difficult, as wget -q will fail the same way
+ # for a 403 as it does for a connect timeout.
+ # Best that can be done without parsing the error output.
+ echo "UNKNOWN - Unable to access /$status_page"
+ exit $ST_UK
fi
if [ -z "$out" ]