Browse Source

Merge pull request #6794 from infinitydev/pvefix

Add error check to Proxmox deploy hooks
pull/6800/head
neil 3 weeks ago
committed by GitHub
parent
commit
12f147bf40
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 6
      deploy/proxmoxbs.sh
  2. 6
      deploy/proxmoxve.sh

6
deploy/proxmoxbs.sh

@ -116,13 +116,15 @@ HEREDOC
export HTTPS_INSECURE=1
export _H1="Authorization: PBSAPIToken=${_proxmoxbs_header_api_token}"
response=$(_post "$_json_payload" "$_target_url" "" POST "application/json")
response="$(echo "$response" | _json_decode | _normalizeJson)"
message=$(echo "$response" | _egrep_o '"message":"[^"]*' | cut -d : -f 2 | tr -d '"')
_retval=$?
if [ "${_retval}" -eq 0 ]; then
if [ "${_retval}" -eq 0 ] && [ -z "$message" ]; then
_debug3 response "$response"
_info "Certificate successfully deployed"
return 0
else
_err "Certificate deployment failed"
_err "Certificate deployment failed: $message"
_debug "Response" "$response"
return 1
fi

6
deploy/proxmoxve.sh

@ -128,13 +128,15 @@ HEREDOC
export HTTPS_INSECURE=1
export _H1="Authorization: PVEAPIToken=${_proxmoxve_header_api_token}"
response=$(_post "$_json_payload" "$_target_url" "" POST "application/json")
response="$(echo "$response" | _json_decode | _normalizeJson)"
message=$(echo "$response" | _egrep_o '"message":"[^"]*' | cut -d : -f 2 | tr -d '"')
_retval=$?
if [ "${_retval}" -eq 0 ]; then
if [ "${_retval}" -eq 0 ] && [ -z "$message" ]; then
_debug3 response "$response"
_info "Certificate successfully deployed"
return 0
else
_err "Certificate deployment failed"
_err "Certificate deployment failed: $message"
_debug "Response" "$response"
return 1
fi

Loading…
Cancel
Save