Format misc/api.func: spacing and heredocs

Clean up formatting in misc/api.func for readability. Normalized spacing in the categorize_error case patterns, removed trailing blank-space lines, and standardized detect_gpu blank-line spacing. Converted heredoc assignments to use multiline $() style for JSON_PAYLOAD in post_tool_to_api, post_addon_to_api, and post_update_to_api_extended, and added a final newline at end of file. No functional changes intended; purely whitespace/formatting cleanup.
This commit is contained in:
CanbiZ (MickLesk) 2026-02-10 08:17:50 +01:00
parent ed3af96585
commit 53cf705799

View File

@ -422,29 +422,29 @@ EOF
categorize_error() {
local code="$1"
case "$code" in
# Network errors
6|7|22|28|35) echo "network" ;;
# Network errors
6 | 7 | 22 | 28 | 35) echo "network" ;;
# Storage errors
214|217|219) echo "storage" ;;
# Storage errors
214 | 217 | 219) echo "storage" ;;
# Dependency/Package errors
100|101|102|127|160|161|162) echo "dependency" ;;
# Dependency/Package errors
100 | 101 | 102 | 127 | 160 | 161 | 162) echo "dependency" ;;
# Permission errors
126|152) echo "permission" ;;
# Permission errors
126 | 152) echo "permission" ;;
# Timeout errors
124|28|211) echo "timeout" ;;
# Timeout errors
124 | 28 | 211) echo "timeout" ;;
# Configuration errors
203|204|205|206|207|208) echo "config" ;;
# Configuration errors
203 | 204 | 205 | 206 | 207 | 208) echo "config" ;;
# Resource errors (OOM, etc)
137|134) echo "resource" ;;
# Resource errors (OOM, etc)
137 | 134) echo "resource" ;;
# Default
*) echo "unknown" ;;
# Default
*) echo "unknown" ;;
esac
}
@ -551,7 +551,8 @@ post_tool_to_api() {
fi
local JSON_PAYLOAD
JSON_PAYLOAD=$(cat <<EOF
JSON_PAYLOAD=$(
cat <<EOF
{
"random_id": "${uuid}",
"type": "tool",
@ -565,7 +566,7 @@ post_tool_to_api() {
"pve_version": "${pve_version}"
}
EOF
)
)
curl -fsS -m "${TELEMETRY_TIMEOUT}" -X POST "${TELEMETRY_URL}" \
-H "Content-Type: application/json" \
@ -615,7 +616,8 @@ post_addon_to_api() {
fi
local JSON_PAYLOAD
JSON_PAYLOAD=$(cat <<EOF
JSON_PAYLOAD=$(
cat <<EOF
{
"random_id": "${uuid}",
"type": "addon",
@ -630,7 +632,7 @@ post_addon_to_api() {
"os_version": "${os_version}"
}
EOF
)
)
curl -fsS -m "${TELEMETRY_TIMEOUT}" -X POST "${TELEMETRY_URL}" \
-H "Content-Type: application/json" \
@ -701,7 +703,8 @@ post_update_to_api_extended() {
fi
local JSON_PAYLOAD
JSON_PAYLOAD=$(cat <<EOF
JSON_PAYLOAD=$(
cat <<EOF
{
"random_id": "${RANDOM_UUID}",
"type": "${TELEMETRY_TYPE:-lxc}",
@ -715,7 +718,7 @@ post_update_to_api_extended() {
"gpu_passthrough": "${gpu_passthrough}"
}
EOF
)
)
curl -fsS -m "${TELEMETRY_TIMEOUT}" -X POST "${TELEMETRY_URL}" \
-H "Content-Type: application/json" \