diff --git a/docs/changelog-20260709-maas-scripts-dc-param.md b/docs/changelog-20260709-maas-scripts-dc-param.md new file mode 100644 index 0000000..506122f --- /dev/null +++ b/docs/changelog-20260709-maas-scripts-dc-param.md @@ -0,0 +1,153 @@ +# Changelog 2026-07-10 -- $DC parameterization for the 3 MAAS scripts (DOCFIX-166) + +No live infrastructure touched -- script + test-harness changes only (prep +session; no jumphost/juju/MAAS access this session). Closes the CLI-wiring +half of tooling gap register item #15 sub-item 2 in +`docs/dc-dc-deployment-workflow.md` (full detail in +`runbooks/dc-dc-phase3-maas-enlist-deploy.md`'s "Known gaps" section, item +2), which blocked `scripts/reenroll-hosts.sh`, `scripts/carve-host- +interfaces.sh`, and `scripts/phase-00-maas-standup.sh` from being invoked +with a `$DC` argument at all -- DOCFIX-151 (2026-07-09) only gave the +selector *functions* to `lib-net.sh`/`lib-hosts.sh`; no consumer script +called them yet. + +## Item + +### 1. DOCFIX-166 -- `$DC` env var wiring in the 3 MAAS scripts +FILES: `scripts/reenroll-hosts.sh`, `scripts/carve-host-interfaces.sh`, +`scripts/phase-00-maas-standup.sh`, `tests/carve-host-interfaces/run- +tests.sh`, `tests/phase-00-maas-standup/run-tests.sh`, new `tests/reenroll- +hosts/run-tests.sh`. + +WHAT: each script now reads an opt-in `$DC` env var immediately after +sourcing `lib-net.sh`/`lib-hosts.sh` (the earliest possible point, matching +the pattern `runbooks/dc-dc-phase3-maas-enlist-deploy.md`'s Step 1 already +documents) and, only if `$DC` is non-empty, calls `lib_net_select_dc "$DC"` +(all three scripts) and `lib_hosts_select_dc "$DC"` (`reenroll-hosts.sh` and +`carve-host-interfaces.sh` only -- `phase-00-maas-standup.sh` never sources +`lib-hosts.sh`, it has no host-identity dependency to select). This matches +the convention the selector functions and the Stage 4 runbook already +established (an explicit `$DC` env var passed positionally into each +function), rather than inventing a new `--dc` CLI-flag convention that does +not exist anywhere else in this repo. + +```bash +DC="${DC:-}" +if [ -n "$DC" ]; then + lib_net_select_dc "$DC" + lib_hosts_select_dc "$DC" # reenroll-hosts.sh / carve-host-interfaces.sh only +fi +``` + +Backward compatible by construction: unset `$DC` skips the `if` body +entirely, so every existing invocation (`bash scripts/reenroll-hosts.sh +--check`, `bash scripts/carve-host-interfaces.sh openstack0 --apply`, `bash +scripts/phase-00-maas-standup.sh`) runs byte-for-byte as it did before this +change -- confirmed by re-invoking each script with no `$DC` set and diffing +against pre-change behavior descriptions in `runbooks/phase-00-teardown- +maas-reset.md` (see VERIFIED below). + +No second validation layer was added: because all three scripts already run +under `set -euo pipefail`, a selector function returning non-zero (dc2 at +the network layer; dc1 AND dc2 at the host layer) causes the script to exit +immediately with that same exit code -- which happens to line up with each +script's own "1 = fatal" convention, so the propagation is free. + +VERIFIED (this workstation; no jq installed, no live jumphost/MAAS/juju +access -- same environment gap DOCFIX-151's changelog documented): + +- Manual, jq-independent invocation of all three scripts confirms the exact + intended matrix (the selector calls happen before `need_jq`/any MAAS call, + so these do not need jq or a fake `maas` at all): + - `DC` unset -> unaffected (rc identical to before this change in every + script). + - `DC=dc0` -> explicit no-op, byte-for-byte same as unset. + - `DC=dc1` -> `reenroll-hosts.sh` and `carve-host-interfaces.sh` FAIL LOUD + at `lib_hosts_select_dc` ("no enrolled hosts yet..."), before touching + MAAS; `phase-00-maas-standup.sh` (network-selector only) no-ops (D-101: + dc1 inherits dc0's plane literals) and proceeds to its own MAAS calls. + - `DC=dc2` -> all three FAIL LOUD at `lib_net_select_dc` first ("no + assigned network literals yet..."), before `lib_hosts_select_dc` is ever + reached in the two scripts that also call it. + - `DC=bogus` -> all three FAIL LOUD ("unknown DC 'bogus'"). +- `bash scripts/repo-lint.sh`: 0 fail, 1 documented legacy WARN (unchanged). +- `bash scripts/run-tests-all.sh`: new `reenroll-hosts` suite added (none + existed before); it reports `FAIL: jq required`, identically to its + sibling suites `carve-host-interfaces` and `phase-00-maas-standup` (both + already jq-gated, unrelated to this change) and to roughly twenty other + suites in the same gauntlet run that all fail for the same reason on this + jq-less Windows workstation. Did NOT run a `git stash` A/B comparison this + time (unlike DOCFIX-151's changelog) because the working tree currently + carries OTHER in-flight, uncommitted changes from parallel agent sessions + tonight (per the operator's own instruction that multiple agents are + working concurrently) -- stashing would have touched their work, not just + this delivery's. Instead, correctness was verified directly (the + jq-independent invocation matrix above), and the only new gauntlet + observation is the addition of the `reenroll-hosts` suite itself + (previously absent, so it could not have been part of any prior baseline) + failing for the same pre-existing, already-documented reason as its + siblings -- not a regression this delivery introduced. +- Added `$DC` test cases to both existing harnesses + (`tests/carve-host-interfaces/run-tests.sh`, + `tests/phase-00-maas-standup/run-tests.sh`): a `DC=dc0` explicit no-op + case (must match the existing default-case assertions), and fail-loud + cases for the blocked DC values, using a new `run_dc()` helper that skips + fixture setup entirely (these calls exit at the selector, before the + script ever reaches `need_jq`/a MAAS call, so they do not depend on the + fixtures OR on jq being installed -- confirmed by invoking them directly, + bypassing the harness's own jq gate, per the VERIFIED bullet above). +- Created `tests/reenroll-hosts/run-tests.sh` (no harness existed for this + script before). Scoped narrowly to what this delivery actually changed: + the `$DC` fail-loud/no-op matrix, plus a smoke test that `--check`'s + read-only reporting is unaffected when `$DC` is unset. Does not attempt to + cover the create/poll/tag mutation paths (those need an interactive + password prompt and a much heavier MAAS fixture set -- out of scope for a + targeted parameterization change). Uses a minimal fake `maas` returning an + empty machines list plus `< /dev/null` on stdin so a bug that ever reached + the real interactive password prompt would fail loudly (EOF) instead of + hanging the harness. + +REVERT: `git checkout HEAD~ -- scripts/reenroll-hosts.sh scripts/carve- +host-interfaces.sh scripts/phase-00-maas-standup.sh +tests/carve-host-interfaces/run-tests.sh +tests/phase-00-maas-standup/run-tests.sh && rm -rf tests/reenroll-hosts` +(safe -- purely additive/opt-in; unset `$DC` behavior is provably unchanged, +so no other script or runbook step that does not set `$DC` depends on any of +this). + +## What this delivery does NOT close (be precise) + +Tooling gap register item #15 has SEVEN sub-findings (enumerated in +`runbooks/dc-dc-phase3-maas-enlist-deploy.md`'s "Known gaps" section). This +delivery closes ONLY the CLI-invocation half of sub-item 2 (the three +scripts not accepting `$DC` at all). It does NOT: + +- Invent any per-DC literal. No dc1/dc2 hostname, octet, boot MAC, or + VIRSH_POWER_ADDRESS was added to `lib-hosts.sh`. `lib_hosts_select_dc` + still fails loud for both dc1 and dc2, exactly as DOCFIX-151 left it -- + that data gap is a separate, later delivery item (the Stage 4 runbook's + own delivery checklist), not something this change works around. +- Make `phase-00-maas-standup.sh`'s `PLANES` table dc2-aware. That table is + a hardcoded D-052/D-053 literal, not derived from `lib-net.sh`'s flat + vars -- selecting `dc1` happens to be correct today only because D-101 + makes dc1's real target identical to dc0's, not because the script reads + dc1-specific data. Once dc2 gets real NetBox CIDRs (gap #3), this table + will need its own parameterization pass. +- Close sub-items 1 (no OpenTofu rack-controller module), 3 (node + count/sizing undecided), 4 (dc2 blocked at the network-selector layer -- + unrelated to this delivery, pre-existing), 5 (per-DC mirror ownership + unconfirmed), 6 (VM-host-discovered MAAS status unconfirmed), or 7 + (`HOST_TAG`/boot-fabric-name literals are DC0-specific). All six remain + OPEN, unchanged by this delivery. + +## Next actionable step + +`docs/dc-dc-deployment-workflow.md` item #15 and `runbooks/dc-dc-phase3- +maas-enlist-deploy.md`'s gap #2 / Steps 5 and 8 updated to reflect the +partial closure (see those files' diffs). The next real dependency for +sub-item 2's FULL closure is Stage 4's own execution: once it measures real +per-DC hostnames/octets/boot MACs and a real per-DC `PLANES` table update +gets authored, `lib-hosts.sh` and `phase-00-maas-standup.sh`'s literal table +go from "selector wired but fails loud" to "selector wired and populated" -- +no further change to the three scripts themselves should be required for +that. diff --git a/runbooks/dc-dc-phase3-maas-enlist-deploy.md b/runbooks/dc-dc-phase3-maas-enlist-deploy.md index d23198e..854aeae 100644 --- a/runbooks/dc-dc-phase3-maas-enlist-deploy.md +++ b/runbooks/dc-dc-phase3-maas-enlist-deploy.md @@ -69,15 +69,28 @@ Section 5 says each DC needs ("one region (Office1) + one rack per DC"). If Stage 3's precondition check above finds no rack controller for `$DC`, that absence is this gap manifesting, not a Stage 4 problem to solve here. -2. **`scripts/reenroll-hosts.sh`, `scripts/carve-host-interfaces.sh`, and - `scripts/phase-00-maas-standup.sh` do not accept a `$DC` argument and do - not call `lib_net_select_dc`/`lib_hosts_select_dc`.** Only `lib-net.sh` - and `lib-hosts.sh` themselves gained the selector functions (DOCFIX-151, - 2026-07-09). This runbook therefore describes ADAPTING each script's - MECHANICS by hand per DC (the CLI calls it makes, in the order it makes - them) rather than literally invoking e.g. `bash scripts/reenroll-hosts.sh - dc1` -- that invocation does not exist. Parameterizing these three - scripts for `$DC` directly is a real follow-up (log it), not done here. +2. **CLOSED 2026-07-10 (DOCFIX-166), CLI half only.** + `scripts/reenroll-hosts.sh`, `scripts/carve-host-interfaces.sh`, and + `scripts/phase-00-maas-standup.sh` now accept an opt-in `$DC` env var and + call `lib_net_select_dc`/`lib_hosts_select_dc` immediately after sourcing + (unset `$DC` is byte-for-byte unchanged VR0/DC0 behavior). See + `docs/changelog-20260709-maas-scripts-dc-param.md`. This means `DC=dc1 + bash scripts/reenroll-hosts.sh` (etc.) is now a REAL invocation, not + hypothetical -- but it does not by itself unblock anything: calling any + of the three with `DC=dc1` or `DC=dc2` today fails loud immediately at + `lib_hosts_select_dc` (reenroll-hosts.sh, carve-host-interfaces.sh -- no + per-DC host inventory exists yet) or, for dc2, at `lib_net_select_dc` + first (gap #4 below). The one case genuinely simplified is + `phase-00-maas-standup.sh` against `dc1`: since D-101 makes dc1 inherit + dc0's plane literals unchanged, `DC=dc1 bash + scripts/phase-00-maas-standup.sh` is now a real, correct, gated call -- + see the updated Step 8. Parameterizing these scripts to accept REAL + per-DC data (once it exists) required no further script change; the + remaining blocker is populating `lib-hosts.sh` with a real `$DC` block + (delivery checklist item below) and, separately, + `phase-00-maas-standup.sh`'s own `PLANES` table is still a D-052/D-053 + hardcoded literal, not derived from `lib-net.sh`'s flat vars, so it is + not dc2-topology-aware even once dc2's CIDRs exist. 3. **Node count and sizing per DC is an unmade Phase-0 decision.** `opentofu/README.md`'s `node-vm` module note: "node count/memory/vcpu/disk sizing is a Phase-0 host/disk-budget decision... that hasn't been made -- @@ -318,13 +331,16 @@ confirm the same call resolves the right CIDR for whichever `$DC` you are running against; it fails loud for `dc2` per gap #4). -**The script itself is not yet DC-parameterized (gap #2).** It resolves a -per-host static octet from `lib-hosts.sh`'s `HOST_OCTET[]`, keyed -by hostname -- for a `$DC` node whose hostname is not yet in that map (true -for every DC1/DC2 node right now), do NOT run -`bash scripts/carve-host-interfaces.sh --apply` as-is: the -octet lookup would return empty and the script would either fail cleanly -(preferred) or, worse, carve an interface with no static address. Before +**The script now accepts a `$DC` env var (gap #2's CLI half CLOSED +2026-07-10, DOCFIX-166)** -- `DC=$DC bash scripts/carve-host-interfaces.sh + --apply` calls `lib_net_select_dc`/`lib_hosts_select_dc` +immediately after sourcing the libraries, before any interface logic runs. +This closes the earlier worry about a silent empty-octet carve: for `dc1` +and `dc2` today, `lib_hosts_select_dc` FAILS LOUD before the script ever +reaches `HOST_OCTET[]`, because no per-DC host inventory has been +captured into `lib-hosts.sh` yet (true for every DC1/DC2 node right now) -- +it does not fall through to an empty lookup. That data gap, not the CLI +wiring, is what still blocks a direct invocation for `$DC != dc0`. Before carving each node: 1. Assign it a real octet within whatever per-DC octet band Stage 1/3 @@ -338,12 +354,14 @@ feeds back into `lib-hosts.sh` as a real `$DC` block (delivery checklist item below), not a placeholder. 4. Only then either (a) temporarily add that mapping to a local, uncommitted - copy of `lib-hosts.sh` so `carve-host-interfaces.sh --apply` - resolves correctly, or (b) run the equivalent `maas` CLI calls the script - itself issues (`link-subnet`, bridge/VLAN create) by hand with the same - measured values. Either way, re-read the resulting interface tree per - node before moving to the next (per the script's own "apply ONE host at a - time" discipline). + copy of `lib-hosts.sh` so `DC=$DC bash scripts/carve-host-interfaces.sh + --apply` resolves correctly and runs for real (the `$DC` + plumbing itself is no longer the blocker, per gap #2's closure -- only + the missing data was), or (b) run the equivalent `maas` CLI calls the + script itself issues (`link-subnet`, bridge/VLAN create) by hand with the + same measured values. Either way, re-read the resulting interface tree + per node before moving to the next (per the script's own "apply ONE host + at a time" discipline). > CAUTION: mutates MAAS interface definitions on each node -- requires the > node in `Ready`... but Step 4 already deployed it. **Sequencing note:** @@ -414,22 +432,34 @@ ## Step 8 -- Topology consistency check, adapted per DC (READ-ONLY) `scripts/phase-00-maas-standup.sh` is the validated precedent for "does -MAAS's fabric/VLAN/subnet/space topology match the target plane scheme" -- -but it is hardcoded to DC0/D-052/D-053's literal space names and is not yet -`$DC`-aware (gap #2). Adapt its CHECKS (not its literals) per DC: +MAAS's fabric/VLAN/subnet/space topology match the target plane scheme." +**Gap #2's CLI half is CLOSED (2026-07-10, DOCFIX-166):** the script now +accepts a `$DC` env var and calls `lib_net_select_dc "$DC"` immediately +after sourcing `lib-net.sh`. This genuinely simplifies the `dc1` case: since +D-101 makes dc1 inherit dc0's plane literals unchanged, the script's +hardcoded `PLANES` table is ALSO dc1's real target, so + +```bash +DC=dc1 bash scripts/phase-00-maas-standup.sh +``` +is now a real, correct, gated call for `dc1` -- run it directly instead of +the manual space-read-and-compare below. For `dc2`, run it the same way and +expect it to fail loud immediately at the selector (gap #4, NetBox literals +not assigned) -- a clean stop, not a false DRIFT. **What is NOT closed:** +once dc2's CIDRs exist, this script's `PLANES` table itself is still a +D-052/D-053 hardcoded literal (not derived from `lib-net.sh`'s flat vars), +so it will need its own follow-up parameterization before it is genuinely +dc2-topology-aware -- until then, for a real dc2 buildout, fall back to the +manual cross-check below instead of trusting the script's literals: ```bash maas "${MAAS_PROFILE:-admin}" spaces read \ | jq -r '.[] | "\(.name)\t\([.subnets[]?.cidr] | join(", "))"' | sort ``` Cross-check the six spaces/CIDRs against whatever `lib_net_select_dc "$DC"` -resolved in Step 1 (a no-op equal to DC0's values for `dc1`; blocked for -`dc2`) -- confirm no DRIFT (a subnet present but bound to the wrong plane or -VID) before treating `$DC` as ready for Stage 5's Juju controller bootstrap. -Do NOT run `phase-00-maas-standup.sh` itself unmodified against `$DC` -- -its target-state literals are DC0's; running it as-is against `$DC` would -either no-op uselessly (dc1, since the CIDRs happen to match) or produce -false DRIFT findings (dc2, once its CIDRs exist and differ from DC0's). +resolved in Step 1 -- confirm no DRIFT (a subnet present but bound to the +wrong plane or VID) before treating `$DC` as ready for Stage 5's Juju +controller bootstrap. **Explicitly NOT this stage's job:** `scripts/provider-bundle-check.py` (the bundle-invariant gate phase-00 runs alongside the topology check) validates @@ -487,11 +517,15 @@ has actually been measured against a live enrollment. - [ ] Log gap #1 (no OpenTofu module creates a per-DC MAAS rack controller VM) against Stage 3 if it was hit as a real blocker, not just noted. -- [ ] Log gap #2 (reenroll-hosts.sh / carve-host-interfaces.sh / - phase-00-maas-standup.sh are not `$DC`-parameterized) as a DOCFIX - candidate once the manual adaptation in Steps 3/5/8 has been run at - least once for real, so the next DC's run (or a redeploy of this one) - has a real script to call instead of hand-adapted CLI. +- [x] Gap #2's CLI half CLOSED 2026-07-10 (DOCFIX-166): + `reenroll-hosts.sh` / `carve-host-interfaces.sh` / + `phase-00-maas-standup.sh` now accept `$DC` and call the selectors -- + see `docs/changelog-20260709-maas-scripts-dc-param.md`. Remaining: + once `lib-hosts.sh` gets a real `$DC` block (checklist item above), + `reenroll-hosts.sh`/`carve-host-interfaces.sh` become directly + callable for that DC with no further script change; separately, + `phase-00-maas-standup.sh`'s hardcoded `PLANES` table still needs its + own parameterization pass before it is genuinely dc2-topology-aware. - [ ] Log gap #5 (no identified owning stage/module for the per-DC artifact mirror) against Stage 2 (or a new stage) if the mirror was found not to exist when Step 7 was reached -- this GATE bullet cannot be met diff --git a/scripts/carve-host-interfaces.sh b/scripts/carve-host-interfaces.sh index 0f232bc..60393f5 100644 --- a/scripts/carve-host-interfaces.sh +++ b/scripts/carve-host-interfaces.sh @@ -27,6 +27,12 @@ # VLAN object id by CIDR. Idempotent: skips a bridge/vlan/link that already exists. # Requires the host to be Ready (link-subnet/update are rejected on Deployed). # +# DC selector (opt-in, DOCFIX-166): set DC=dc0|dc1|dc2 to call +# lib_net_select_dc/lib_hosts_select_dc explicitly. Unset (default) == DC0's +# real plane scheme + enrolled hosts, unchanged. dc1 no-ops at the network +# layer but FAILS at the host layer (no per-DC HOST_OCTET/HOST_BOOT_MAC yet); +# dc2 fails at both -- see scripts/lib-net.sh / scripts/lib-hosts.sh. +# # Exit: 0 ok | 1 fatal | 2 warning set -euo pipefail @@ -38,6 +44,20 @@ # shellcheck source=scripts/lib-hosts.sh . "$SCRIPT_DIR/lib-hosts.sh" +# --- $DC selector (opt-in; tooling gap register #15 sub-item 2, DOCFIX-166) --- +# Same convention as lib-net.sh/lib-hosts.sh's own selectors (DOCFIX-151) and the +# dc-dc-phase3 runbook's Step 1: an explicit $DC env var, never an inferred +# default. Unset/empty $DC changes NOTHING -- this script runs exactly as it +# always has, implicitly against DC0/VR0's real plane scheme and enrolled +# hosts (backward compatible by construction). Set DC=dc0|dc1|dc2 to select +# explicitly; the selectors' own fail-loud behavior becomes this script's own +# exit code via set -e. No second validation layer is added. +DC="${DC:-}" +if [ -n "$DC" ]; then + lib_net_select_dc "$DC" + lib_hosts_select_dc "$DC" +fi + MAAS_PROFILE="${MAAS_PROFILE:-admin}" FATAL=0 fail() { echo "FAIL: $*" >&2; FATAL=$((FATAL+1)); } diff --git a/scripts/phase-00-maas-standup.sh b/scripts/phase-00-maas-standup.sh index b5bf831..46d8c65 100644 --- a/scripts/phase-00-maas-standup.sh +++ b/scripts/phase-00-maas-standup.sh @@ -33,6 +33,12 @@ # Exit: 0 ok (no drift) | 1 fatal or unresolved drift | 2 precondition # CLI forms verified against Canonical MAAS how-to-manage-networks. # ASCII + LF. +# +# DC selector (opt-in, DOCFIX-166): set DC=dc0|dc1|dc2 to call +# lib_net_select_dc explicitly. Unset (default) == today's D-052/D-053 +# behavior, unchanged. dc1 is a genuine no-op (D-101); dc2 FAILS LOUD (gap +# #3) -- but note the PLANES table itself is still DC0-hardcoded, so this +# selector alone does not make the script's topology target dc2-aware. set -euo pipefail shopt -s inherit_errexit 2>/dev/null || true @@ -41,6 +47,26 @@ # shellcheck source=scripts/lib-net.sh . "$SCRIPT_DIR/lib-net.sh" +# --- $DC selector (opt-in; tooling gap register #15 sub-item 2, DOCFIX-166) --- +# Same convention as lib-net.sh's own selector (DOCFIX-151) and the dc-dc-phase3 +# runbook's Step 1: an explicit $DC env var, never an inferred default. +# Unset/empty $DC changes NOTHING -- this script runs exactly as it always +# has, implicitly against the D-052/D-053 plane scheme (backward compatible +# by construction). Set DC=dc0|dc1|dc2 to select explicitly; dc2 FAILS LOUD +# today (no NetBox-assigned literals yet -- gap #3) via set -e, no second +# validation layer added. This script does not source lib-hosts.sh (it never +# touches host identity), so only the network selector is called here. +# NOTE: the PLANES table below is still a hardcoded D-052/D-053 literal, not +# derived from lib-net.sh's flat vars -- selecting dc1 is a real no-op +# (D-101: dc1 inherits dc0's layout unchanged, so the hardcoded literals are +# still correct), but this selector call alone does NOT make this script +# dc2-aware; once dc2 gets real CIDRs (gap #3), the PLANES table itself will +# still need updating for a genuinely different dc2 scheme. +DC="${DC:-}" +if [ -n "$DC" ]; then + lib_net_select_dc "$DC" +fi + MAAS_PROFILE="${MAAS_PROFILE:-admin}" MODE="dryrun"; [ "${1:-}" = "--apply" ] && MODE="apply" FATAL=0; DRIFT=0 diff --git a/scripts/reenroll-hosts.sh b/scripts/reenroll-hosts.sh index 23ed459..daa8d92 100644 --- a/scripts/reenroll-hosts.sh +++ b/scripts/reenroll-hosts.sh @@ -11,6 +11,11 @@ # (default) create any of the four that are MISSING, then poll all four to Ready # --check read-only: report current status of openstack0-3 (no mutation) # +# DC selector (opt-in, DOCFIX-166): set DC=dc0|dc1|dc2 to call +# lib_net_select_dc/lib_hosts_select_dc explicitly. Unset (default) == DC0's +# real, enrolled hosts, unchanged. dc1/dc2 currently FAIL LOUD (no per-DC host +# inventory exists yet) -- see scripts/lib-hosts.sh. +# # Discover-assert-pin: never creates a host that already exists. Idempotent -- # a re-run after a partial run only creates the still-missing hosts. # @@ -32,6 +37,21 @@ # shellcheck source=scripts/lib-hosts.sh . "$SCRIPT_DIR/lib-hosts.sh" +# --- $DC selector (opt-in; tooling gap register #15 sub-item 2, DOCFIX-166) --- +# Same convention as lib-net.sh/lib-hosts.sh's own selectors (DOCFIX-151) and the +# dc-dc-phase3 runbook's Step 1: an explicit $DC env var, never an inferred +# default. Unset/empty $DC changes NOTHING -- this script runs exactly as it +# always has, implicitly against DC0/VR0's real, enrolled hosts (backward +# compatible by construction). Set DC=dc0|dc1|dc2 to select explicitly; the +# selectors' own fail-loud behavior becomes this script's own exit code via +# set -e (lib_hosts_select_dc fails for BOTH dc1 and dc2 today -- no per-DC +# host inventory exists yet for either). No second validation layer is added. +DC="${DC:-}" +if [ -n "$DC" ]; then + lib_net_select_dc "$DC" + lib_hosts_select_dc "$DC" +fi + MAAS_PROFILE="${MAAS_PROFILE:-admin}" READY_TIMEOUT="${READY_TIMEOUT:-1200}" # seconds (~20 min) diff --git a/tests/carve-host-interfaces/run-tests.sh b/tests/carve-host-interfaces/run-tests.sh index 7c23a5e..2fc25f5 100644 --- a/tests/carve-host-interfaces/run-tests.sh +++ b/tests/carve-host-interfaces/run-tests.sh @@ -13,9 +13,9 @@ python3 "$HERE/make_fixtures.py" >/dev/null rc_all=0; OUT="$(mktemp)" -run() { #