Skip to content
This repository was archived by the owner on Jun 20, 2024. It is now read-only.

Commit

Permalink
better error handling for invalid weave status sub-command
Browse files Browse the repository at this point in the history
instead of showing '404 page not found'

Fixes #1328.
  • Loading branch information
rade committed Aug 20, 2015
1 parent 812579a commit ceff3be
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion weave
Original file line number Diff line number Diff line change
Expand Up @@ -1360,13 +1360,28 @@ case "$COMMAND" in
res=0
SUB_STATUS=
STATUS_URL="/status"
SUB_COMMAND="$@"
while [ $# -gt 0 ] ; do
SUB_STATUS=1
STATUS_URL="$STATUS_URL/$1"
shift
done
[ -n "$SUB_STATUS" ] || echo
call_weave GET $STATUS_URL || res=1
if status=$(call_weave GET $STATUS_URL) ; then
case "$status" in
"")
;;
"404 page not found")
echo "Invalid 'weave status' sub-command: $SUB_COMMAND" >&2
usage
;;
*)
echo "$status"
;;
esac
else
res=1
fi
if [ -z "$SUB_STATUS" ] && check_running $PROXY_CONTAINER_NAME 2>/dev/null && PROXY_ADDR=$(proxy_addr) ; then
echo
echo " Service: proxy"
Expand Down

0 comments on commit ceff3be

Please sign in to comment.