From 952ea06725c8bf518955f2e5c42385573c1e6912 Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 20 May 2015 21:26:55 +0200 Subject: lib/cac.sh cac_listservers: check response status --- lib/cac.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/cac.sh b/lib/cac.sh index 0bc9d3369..7ed06012a 100644 --- a/lib/cac.sh +++ b/lib/cac.sh @@ -1,8 +1,15 @@ . ./lib/url.sh -cac_listservers() { - _cac_get_api_v1 listservers -} +cac_listservers() {( + listservers=$(_cac_get_api_v1 listservers) + status=$(echo "$listservers" | jq -r .status) + if [ "$status" = ok ]; then + echo "$listservers" + else + echo "$0: bad listservers status: $status" >&2 + exit 1 + fi +)} cac_listtasks() { _cac_get_api_v1 listtasks -- cgit v1.2.3