feat(controller-peers-env-fallback): pin the generated xceadmin wrapper to its own deployment (task 5.1)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Rongsong Shen 2026-10-03 08:04:03 +00:00
parent 148507980b
commit ac7a43855d
Signed by untrusted user: rshen
GPG key ID: 80533536B0EB651C
3 changed files with 72 additions and 1 deletions

View file

@ -686,10 +686,19 @@ if [ -n "$XCEADMIN_WHEEL" ]; then
# connecting to the wrong port with no override given). An explicit
# `--controller ...` on the command line still wins (click's own
# envvar-fallback precedence, xceadmin/cli.py).
#
# XCE_CONTROLLER_PEERS is pinned too, to this deploy's full $PEERS_STR:
# xceadmin reads it AHEAD of XCEADMIN_CONTROLLER, so an ambient value
# left in the caller's shell for a different cluster would otherwise
# silently redirect this deployment's wrapper there despite the legacy
# export above. Exporting the whole list (not just the first candidate)
# also lets the wrapper fail over across every controller of this
# deployment.
cat > "$TOP/scripts/xceadmin" << EOF
#!$GEN_BASH
export PYTHONPATH="$TOP/xceadmin-site:$PYTHONPATH"
export XCEADMIN_CONTROLLER="${PEER_ARRAY[0]}"
export XCE_CONTROLLER_PEERS="$PEERS_STR"
exec $(command -v python3) -m xceadmin.cli "\$@"
EOF
chmod +x "$TOP/scripts/xceadmin"