summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2015-05-20 21:26:55 +0200
committertv <tv@krebsco.de>2015-05-20 21:26:55 +0200
commit4fae1fdb0d2b7769a8ba6468eee79d109c00d8ab (patch)
tree02857c0b284c8618af38677c4cb66fe84e1bf1b7 /lib
parent25d4a34da8b9573fd3ff162645a2ebe6c57e149b (diff)
lib/cac.sh cac_listservers: check response status
Diffstat (limited to 'lib')
-rw-r--r--lib/cac.sh13
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/cac.sh b/lib/cac.sh
index 0bc9d33..7ed0601 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