From 2fa3116c9c35fd0951f228c3476e35dcacfcc7b8 Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com> Date: Fri, 31 Jan 2025 09:37:51 +0100 Subject: [PATCH] [API] update build.func (#1894) * [API] update build.func * [API] update build.func --- misc/build.func | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/misc/build.func b/misc/build.func index 3e623537..c6c6bb25 100644 --- a/misc/build.func +++ b/misc/build.func @@ -2,8 +2,7 @@ # Author: tteck (tteckster) # Co-Author: MickLesk # Co-Author: michelroegl-brunner -# License: MIT -# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE variables() { NSAPP=$(echo ${APP,,} | tr -d ' ') # This function sets the NSAPP variable by converting the value of the APP variable to lowercase and removing any spaces. @@ -73,7 +72,6 @@ error_handler() { local exit_code="$?" local line_number="$1" local command="$2" - post_update_to_api "failed" local error_message="${RD}[ERROR]${CL} in line ${RD}$line_number${CL}: exit code ${RD}$exit_code${CL}: while executing command ${YW}$command${CL}" echo -e "\n$error_message\n" } @@ -794,6 +792,9 @@ advanced_settings() { } post_to_api() { + if [ "$DIAGNOSTICS" = "no" ]; then + return 0 + fi local API_URL="http://api.community-scripts.org/upload" local pve_version="not found" pve_version=$(pveversion | awk -F'[/ ]' '{print $2}') @@ -831,13 +832,17 @@ EOF } POST_UPDATE_DONE=false - post_update_to_api() { + if [ "$DIAGNOSTICS" = "no" ]; then + return 0 + fi if [ "$POST_UPDATE_DONE" = true ]; then return 0 fi + local API_URL="http://api.community-scripts.org/upload/updatestatus" - local status="${1:-}" + local status="${1:-failed}" + JSON_PAYLOAD=$(cat <