felhom-host-install.sh 1.35.0 (not published): the hub's live-box 409 is worded in EN and HU at the preflight, host-enroll and the controller.yaml fetch, with harness cases (R-1167)
gates / gates (push) Failing after 7m16s

This commit is contained in:
admin committed 2026-10-19 20:35:21 +02:00
1 parent 5f31da04bc
commit d92a712ee4
3 files changed
+91 -3

No files matched your search

+20 -3
View File
@@ -194,7 +194,7 @@
set -euo pipefail
SCRIPT_VERSION="1.34.0" # the SINGLE version source (F-1): -h and the run banners follow it.
SCRIPT_VERSION="1.35.0" # the SINGLE version source (F-1): -h and the run banners follow it.
# The hub used to carry a copy for its Setup tab; R-94 DELETED it
# (2026-08-02) because the hub cannot know which version a box runs —
# the Setup command fetches this script at run time. scripts/
@@ -227,6 +227,15 @@ log_success() { echo -e "${GREEN}[OK]${NC} $1"; }
log_skip() { echo -e "${CYAN}[SKIP]${NC} $1"; }
log_dry() { echo -e "${CYAN}[DRY-RUN]${NC} $1"; }
die() { log_error "$1"; exit 1; }
# R-1167 (1.35.0): since hub 0.161.0 (R-1159) the hub answers 409 when this customer's box is LIVE — its controller
# pulls its config with its own key, so the household passphrase gives no keys any more. Say what to do, EN and HU.
# Pinned by the harness case R-1167 (every passphrase call maps 409 here; the text names the delete and the re-run).
die_live_box() { # $1 = the hub call that answered 409
die "the hub answered 409 on $1: this customer already has a live box, which uses its own key.
The operator deletes the old host on the hub first (Hosts page); then run this installer again.
HU: a hub 409-cel válaszolt ($1): ennek az ügyfélnek már van élő gépe, amely a saját kulcsát használja.
Előbb az üzemeltető törli a régi gépet a hubon (Hosts oldal), aztán futtasd újra ezt a telepítőt."
}
#-------------------------------------------------------------------------------
# Defaults
@@ -476,9 +485,15 @@ resolve_artifacts() {
# hub-vouched sha256 + visudo/sh -n validation, never from transport auth). Loud warn, never die:
# a customer config without a git token must not block day-0 while the anonymous path works.
resolve_git_creds() {
local yaml
yaml=$(curl -fsS "$HUB_URL/api/v1/config/$CUSTOMER_ID" -H "X-Retrieval-Password: $PASSPHRASE") \
local yaml resp code
resp=$(curl -sS -w $'\n%{http_code}' "$HUB_URL/api/v1/config/$CUSTOMER_ID" -H "X-Retrieval-Password: $PASSPHRASE") \
|| die "controller.yaml fetch failed (for the git fetch credential)"
code=$(tail -n1 <<<"$resp"); yaml=$(sed '$d' <<<"$resp")
case "$code" in
200) ;;
409) die_live_box "the controller.yaml fetch (GET /config)" ;;
*) die "controller.yaml fetch failed (hub status $code, for the git fetch credential)" ;;
esac
GIT_USER=$(awk '/^[^[:space:]#]/{ingit=($1=="git:")} ingit&&$1=="username:"{print $2}' <<<"$yaml" | head -1)
GIT_TOKEN=$(awk '/^[^[:space:]#]/{ingit=($1=="git:")} ingit&&$1=="token:"{print $2}' <<<"$yaml" | head -1)
# strip any surrounding quotes
@@ -2319,6 +2334,7 @@ step_preflight() {
200) log_success " customer '$CUSTOMER_ID' exists + passphrase valid" ;;
401) die "passphrase REJECTED (401) for customer '$CUSTOMER_ID'" ;;
404) die "customer '$CUSTOMER_ID' not found in hub (404) — create it in the hub first" ;;
409) die_live_box "the config preflight (GET /config)" ;;
*) die "unexpected hub status $code on config preflight" ;;
esac
@@ -2557,6 +2573,7 @@ step_enroll() {
200) log_success " host REUSED (idempotent — existing credential)" ;;
401) die "host-enroll 401 (passphrase) — should have been caught in preflight" ;;
404) die "host-enroll 404 (unknown customer)" ;;
409) die_live_box "host-enroll (POST /host-enroll)" ;;
*) die "host-enroll unexpected $code: $body" ;;
esac
HOST_ID=$(python3 -c "import json,sys;print(json.loads(sys.argv[1])['host_id'])" "$body")