Fix Pangolin site creation: omit address field from payload
The clientAddress from pickSiteDefaults lacks CIDR notation and gets rejected by the Pangolin API. Omitting it lets Pangolin auto-assign. Bunker Admin
This commit is contained in:
parent
f0d994074d
commit
bca4cb8227
@ -1075,10 +1075,9 @@ pangolin_create_site() {
|
|||||||
local defaults_resp
|
local defaults_resp
|
||||||
defaults_resp=$(pangolin_api GET "$api_url/org/$org_id/pick-site-defaults" "$api_key")
|
defaults_resp=$(pangolin_api GET "$api_url/org/$org_id/pick-site-defaults" "$api_key")
|
||||||
|
|
||||||
local newt_id newt_secret client_address
|
local newt_id newt_secret
|
||||||
newt_id=$(echo "$defaults_resp" | jq -r '.data.newtId // .newtId // empty' 2>/dev/null)
|
newt_id=$(echo "$defaults_resp" | jq -r '.data.newtId // .newtId // empty' 2>/dev/null)
|
||||||
newt_secret=$(echo "$defaults_resp" | jq -r '.data.newtSecret // .newtSecret // .data.secret // .secret // empty' 2>/dev/null)
|
newt_secret=$(echo "$defaults_resp" | jq -r '.data.newtSecret // .newtSecret // .data.secret // .secret // empty' 2>/dev/null)
|
||||||
client_address=$(echo "$defaults_resp" | jq -r '.data.clientAddress // .clientAddress // .data.address // .address // empty' 2>/dev/null)
|
|
||||||
|
|
||||||
if [[ -z "$newt_id" || -z "$newt_secret" ]]; then
|
if [[ -z "$newt_id" || -z "$newt_secret" ]]; then
|
||||||
warn "Could not fetch Newt credentials from pickSiteDefaults."
|
warn "Could not fetch Newt credentials from pickSiteDefaults."
|
||||||
@ -1090,12 +1089,13 @@ pangolin_create_site() {
|
|||||||
|
|
||||||
info "Creating site \"$site_name\"..."
|
info "Creating site \"$site_name\"..."
|
||||||
local create_payload
|
local create_payload
|
||||||
|
# Note: omit 'address' — Pangolin auto-assigns it; clientAddress from
|
||||||
|
# pickSiteDefaults lacks CIDR notation and gets rejected.
|
||||||
create_payload=$(jq -n \
|
create_payload=$(jq -n \
|
||||||
--arg name "$site_name" \
|
--arg name "$site_name" \
|
||||||
--arg newtId "$newt_id" \
|
--arg newtId "$newt_id" \
|
||||||
--arg secret "$newt_secret" \
|
--arg secret "$newt_secret" \
|
||||||
--arg address "$client_address" \
|
'{name: $name, type: "newt", newtId: $newtId, secret: $secret}')
|
||||||
'{name: $name, type: "newt", newtId: $newtId, secret: $secret, address: $address}')
|
|
||||||
|
|
||||||
local site_resp
|
local site_resp
|
||||||
site_resp=$(pangolin_api PUT "$api_url/org/$org_id/site" "$api_key" "$create_payload")
|
site_resp=$(pangolin_api PUT "$api_url/org/$org_id/site" "$api_key" "$create_payload")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user