fix if CA server is unavailable
This commit is contained in:
parent
013fc774c0
commit
b7272412b4
1 changed files with 8 additions and 1 deletions
|
@ -5,6 +5,13 @@ IFS=$'\n\t'
|
||||||
eval "$(jq -r '@sh "PUBKEY=\(.pubkey) HOST=\(.host) CAHOST=\(.cahost)"')"
|
eval "$(jq -r '@sh "PUBKEY=\(.pubkey) HOST=\(.host) CAHOST=\(.cahost)"')"
|
||||||
|
|
||||||
# TODO: Can this be done more eye-pleasingly?
|
# TODO: Can this be done more eye-pleasingly?
|
||||||
CERT=$(ssh root@$CAHOST '/root/ca.sh host "'"$PUBKEY"'" "'"$HOST"'".dmz')
|
set +e
|
||||||
|
CERT=$(ssh -o ConnectTimeout=3 -o ConnectionAttempts=1 root@$CAHOST '/root/ca.sh host "'"$PUBKEY"'" "'"$HOST"'".dmz')
|
||||||
|
retval=$?
|
||||||
|
set -e
|
||||||
|
|
||||||
|
if [ retval -neq 0 ]; then
|
||||||
|
CERT="error"
|
||||||
|
fi
|
||||||
|
|
||||||
jq -n --arg cert "$CERT" '{"cert":$cert}'
|
jq -n --arg cert "$CERT" '{"cert":$cert}'
|
||||||
|
|
Reference in a new issue