Fix set -e crash in pangolin_create_resources arithmetic

((created++)) returns exit code 1 when created=0 (post-increment
evaluates to 0, which is falsy), killing the script under set -e.
Use x=$((x + 1)) instead.

Bunker Admin
This commit is contained in:
bunker-admin 2026-04-09 13:03:12 -06:00
parent 0510420772
commit ca446136a1

View File

@ -1155,10 +1155,10 @@ pangolin_create_resources() {
local err_msg
err_msg=$(echo "$res_resp" | jq -r '.message // "unknown error"' 2>/dev/null)
if echo "$err_msg" | grep -qi "already exists\|duplicate\|conflict"; then
((skipped++))
skipped=$((skipped + 1))
else
warn " Failed to create $full_domain: $err_msg"
((failed++))
failed=$((failed + 1))
fi
continue
fi
@ -1175,7 +1175,7 @@ pangolin_create_resources() {
pangolin_api POST "$api_url/resource/$resource_id" "$api_key" \
'{"sso":false,"blockAccess":false}' >/dev/null
((created++))
created=$((created + 1))
done
if [[ $created -gt 0 ]]; then