Skip to content

Commit 2574e41

Browse files
Prevent api from posing if disabled (#5080)
1 parent 2aeb7cf commit 2574e41

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

misc/api.func

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,11 @@ post_to_api() {
3939
EOF
4040
)
4141

42-
RESPONSE=$(curl -fsSL -w "%{http_code}" -L -X POST "$API_URL" --post301 --post302 \
42+
if [[ "$DIAGNOSTICS" == "yes" ]]; then
43+
RESPONSE=$(curl -s -w "%{http_code}" -L -X POST "$API_URL" --post301 --post302 \
4344
-H "Content-Type: application/json" \
4445
-d "$JSON_PAYLOAD") || true
46+
fi
4547
}
4648

4749
post_to_api_vm() {
@@ -87,9 +89,11 @@ post_to_api_vm() {
8789
EOF
8890
)
8991

90-
RESPONSE=$(curl -fsSL -w "%{http_code}" -L -X POST "$API_URL" --post301 --post302 \
92+
if [[ "$DIAGNOSTICS" == "yes" ]]; then
93+
RESPONSE=$(curl -s -w "%{http_code}" -L -X POST "$API_URL" --post301 --post302 \
9194
-H "Content-Type: application/json" \
9295
-d "$JSON_PAYLOAD") || true
96+
fi
9397
}
9498

9599
POST_UPDATE_DONE=false
@@ -115,9 +119,11 @@ post_update_to_api() {
115119
EOF
116120
)
117121

118-
RESPONSE=$(curl -fsSL -w "%{http_code}" -L -X POST "$API_URL" --post301 --post302 \
122+
if [[ "$DIAGNOSTICS" == "yes" ]]; then
123+
RESPONSE=$(curl -s -w "%{http_code}" -L -X POST "$API_URL" --post301 --post302 \
119124
-H "Content-Type: application/json" \
120125
-d "$JSON_PAYLOAD") || true
126+
fi
121127

122128
POST_UPDATE_DONE=true
123129
}

misc/build.func

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1090,6 +1090,8 @@ build_container() {
10901090
else
10911091
export FUNCTIONS_FILE_PATH="$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/install.func)"
10921092
fi
1093+
1094+
export DIAGNOSTICS="$DIAGNOSTICS"
10931095
export RANDOM_UUID="$RANDOM_UUID"
10941096
export CACHER="$APT_CACHER"
10951097
export CACHER_IP="$APT_CACHER_IP"

0 commit comments

Comments
 (0)