refactor: simplify BinaryLane wait loop and fix log_warn in 7 cloud polling loops (#538)

Replace 25-line custom _binarylane_wait_for_active with 4-line
generic_wait_for_instance call, matching the pattern used by 7 other
clouds (DigitalOcean, Vultr, Linode, etc).

Change log_warn to log_step for status/progress messages in polling
loops across 7 cloud providers (aws-lightsail, exoscale, fly, kamatera,
latitude, ovh, scaleway). These are normal status updates, not warnings.

Agent: complexity-hunter

Co-authored-by: A <6723574+louisgv@users.noreply.github.com>
Co-authored-by: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
A 2026-02-11 14:59:51 -08:00 committed by GitHub
parent 8ad9f8bd2c
commit c8d7ea23e6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 12 additions and 31 deletions

View file

@ -110,29 +110,10 @@ get_server_name() {
# Poll the BinaryLane API until the server becomes active and has an IP
# Sets BINARYLANE_SERVER_IP on success
_binarylane_wait_for_active() {
log_step "Waiting for server to become active..."
local max_attempts=60
local attempt=1
while [[ "$attempt" -le "$max_attempts" ]]; do
local status_response
status_response=$(binarylane_api GET "/servers/$BINARYLANE_SERVER_ID")
local status
status=$(echo "$status_response" | python3 -c "import json,sys; print(json.loads(sys.stdin.read())['server']['status'])")
if [[ "$status" == "active" ]]; then
BINARYLANE_SERVER_IP=$(echo "$status_response" | python3 -c "import json,sys; networks = json.loads(sys.stdin.read())['server']['networks']['v4']; print([n['ip_address'] for n in networks if n['type'] == 'public'][0])")
export BINARYLANE_SERVER_IP
log_info "Server active: IP=$BINARYLANE_SERVER_IP"
return 0
fi
log_warn "Server status: $status ($attempt/$max_attempts)"
sleep "${INSTANCE_STATUS_POLL_DELAY}"
attempt=$((attempt + 1))
done
log_error "Server did not become active in time"
return 1
generic_wait_for_instance binarylane_api "/servers/$BINARYLANE_SERVER_ID" \
"active" "d['server']['status']" \
"next(n['ip_address'] for n in d['server']['networks']['v4'] if n['type']=='public')" \
BINARYLANE_SERVER_IP "Server" 60
}
# Build JSON request body for BinaryLane server creation