lib/cac.sh cac_listservers: check response status
This commit is contained in:
parent
4c00375cb2
commit
952ea06725
8
infest
8
infest
@ -21,14 +21,6 @@ nix_find_sha1sum=86f8775bd4f0841edd4c816df861cebf509d58c3
|
|||||||
main() {
|
main() {
|
||||||
listservers=$(cac_listservers)
|
listservers=$(cac_listservers)
|
||||||
|
|
||||||
listserversstatus=$(echo $listservers | jq -r .status)
|
|
||||||
case $listserversstatus in
|
|
||||||
ok) : ;;
|
|
||||||
*)
|
|
||||||
echo $0: bad listservers status: $listserversstatus >&2
|
|
||||||
exit 1
|
|
||||||
esac
|
|
||||||
|
|
||||||
config=$(echo $listservers \
|
config=$(echo $listservers \
|
||||||
| jq -r ".data|map(select(.servername == \"$cac_servername\"))[]")
|
| jq -r ".data|map(select(.servername == \"$cac_servername\"))[]")
|
||||||
|
|
||||||
|
13
lib/cac.sh
13
lib/cac.sh
@ -1,8 +1,15 @@
|
|||||||
. ./lib/url.sh
|
. ./lib/url.sh
|
||||||
|
|
||||||
cac_listservers() {
|
cac_listservers() {(
|
||||||
_cac_get_api_v1 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_listtasks() {
|
||||||
_cac_get_api_v1 listtasks
|
_cac_get_api_v1 listtasks
|
||||||
|
@ -22,14 +22,6 @@ hostname=$2
|
|||||||
main() {
|
main() {
|
||||||
listservers=$(cac_listservers)
|
listservers=$(cac_listservers)
|
||||||
|
|
||||||
listserversstatus=$(echo $listservers | jq -r .status)
|
|
||||||
case $listserversstatus in
|
|
||||||
ok) : ;;
|
|
||||||
*)
|
|
||||||
echo $0: bad listservers status: $listserversstatus >&2
|
|
||||||
exit 1
|
|
||||||
esac
|
|
||||||
|
|
||||||
config=$(echo $listservers \
|
config=$(echo $listservers \
|
||||||
| jq -r ".data|map(select(.servername == \"$cac_servername\"))[]")
|
| jq -r ".data|map(select(.servername == \"$cac_servername\"))[]")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user