From 2c7ff229a58440eef92abe247ea070e6c9c08dc0 Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner Date: Tue, 10 Jun 2025 08:58:04 +0200 Subject: [PATCH] Api testing --- misc/api.func | 13 ++++++++++--- misc/build.func | 1 + 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/misc/api.func b/misc/api.func index b93a0fb2..08bdc914 100644 --- a/misc/api.func +++ b/misc/api.func @@ -90,9 +90,12 @@ post_to_api() { } EOF ) - RESPONSE=$(curl -s -w "%{http_code}" -L -X POST "$API_URL" --post301 --post302 \ + if [[ "$DIAGNOSTICS" == "yes" ]]; then + RESPONSE=$(curl -s -w "%{http_code}" -L -X POST "$API_URL" --post301 --post302 \ -H "Content-Type: application/json" \ -d "$JSON_PAYLOAD") || true + fi + } post_to_api_vm() { @@ -138,9 +141,11 @@ post_to_api_vm() { } EOF ) - RESPONSE=$(curl -s -w "%{http_code}" -L -X POST "$API_URL" --post301 --post302 \ + if [[ "$DIAGNOSTICS" == "yes" ]]; then + RESPONSE=$(curl -s -w "%{http_code}" -L -X POST "$API_URL" --post301 --post302 \ -H "Content-Type: application/json" \ -d "$JSON_PAYLOAD") || true + fi } POST_UPDATE_DONE=false @@ -181,9 +186,11 @@ post_update_to_api() { } EOF ) - RESPONSE=$(curl -s -w "%{http_code}" -L -X POST "$API_URL" --post301 --post302 \ + if [[ "$DIAGNOSTICS" == "yes" ]]; then + RESPONSE=$(curl -s -w "%{http_code}" -L -X POST "$API_URL" --post301 --post302 \ -H "Content-Type: application/json" \ -d "$JSON_PAYLOAD") || true + fi POST_UPDATE_DONE=true } diff --git a/misc/build.func b/misc/build.func index f2022a8d..0d1ddd2b 100644 --- a/misc/build.func +++ b/misc/build.func @@ -979,6 +979,7 @@ build_container() { else export FUNCTIONS_FILE_PATH="$(curl -fsSL https://git.community-scripts.org/community-scripts/ProxmoxVED/raw/branch/main/misc/install.func)" fi + export DIAGNOSTICS="$DIAGNOSTICS" export RANDOM_UUID="$RANDOM_UUID" export CACHER="$APT_CACHER" export CACHER_IP="$APT_CACHER_IP"