mirror of
https://github.com/community-scripts/ProxmoxVED.git
synced 2026-02-25 05:57:26 +00:00
Api update
This commit is contained in:
@@ -43,11 +43,12 @@ EOF
|
||||
-H "Content-Type: application/json" \
|
||||
-d "$JSON_PAYLOAD") || true
|
||||
}
|
||||
echo -e "Posting to API... "
|
||||
|
||||
|
||||
get_error_description() {
|
||||
local exit_code="$1"
|
||||
case "$exit_code" in
|
||||
0) echo " " ;;
|
||||
1) echo "General error: An unspecified error occurred." ;;
|
||||
2) echo "Incorrect shell usage or invalid command arguments." ;;
|
||||
3) echo "Unexecuted function or invalid shell condition." ;;
|
||||
@@ -155,10 +156,16 @@ post_update_to_api() {
|
||||
fi
|
||||
|
||||
local status="${1:-failed}"
|
||||
local exit_code="${2:-0}"
|
||||
local error_description="$(get_error_description "$exit_code")"
|
||||
if [[ "$status" == "failed" ]]; then
|
||||
local exit_code="${2:-1}"
|
||||
elif [[ "$status" == "success" ]]; then
|
||||
local exit_code="${2:-0}"
|
||||
fi
|
||||
|
||||
|
||||
local API_URL="http://api.community-scripts.org/dev/upload/updatestatus"
|
||||
local error="${exit_code}: ${error_description}"
|
||||
error=$(get_error_description "$exit_code")
|
||||
|
||||
|
||||
if [ -z "$error" ]; then
|
||||
error="Unknown error"
|
||||
|
||||
Reference in New Issue
Block a user