Failover Coverage and Shared Services pickers on the Partnership page
Coverage edits FALLBACK_<me>_TIER1-4 directly — the array fallback.sh reads during an outage — rather than a parallel list that could drift from it.
This commit is contained in:
@@ -109,11 +109,31 @@ if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
|
||||
// ── Write ────────────────────────────────────────────────────────────────────────────────────
|
||||
$action = $_POST['action'] ?? '';
|
||||
|
||||
// Containers this host runs, PLUS whatever the lists already name. The conf legitimately holds
|
||||
// entries for containers that are not here right now — one removed since it was added, one
|
||||
// living on a partner, one simply stopped. Validating only against the running set would refuse
|
||||
// to save a list the operator had not touched: FALLBACK_HOST1_TIER4 still carries "LidaTube",
|
||||
// which no longer exists here, so opening the card and pressing Save would fail on a line
|
||||
// nobody had edited.
|
||||
//
|
||||
// New names still have to be real. The guard is against inventing containers, not against
|
||||
// keeping ones already recorded.
|
||||
$known = [];
|
||||
foreach (vv_docker_containers() as $c) {
|
||||
$n = is_array($c) ? ($c['name'] ?? '') : (string)$c;
|
||||
if ($n !== '') $known[strtolower($n)] = $n;
|
||||
}
|
||||
$existingRaw = vv_read_conf_raw($myConf);
|
||||
foreach ($TIERS as $t) {
|
||||
foreach (vv_parse_conf_list($existingRaw, $tierVar($t)) as $n) {
|
||||
$n = trim($n);
|
||||
if ($n !== '' && !isset($known[strtolower($n)])) $known[strtolower($n)] = $n;
|
||||
}
|
||||
}
|
||||
foreach (vv_parse_conf_list($existingRaw, $svcVar) as $x) {
|
||||
$n = $fromXml($x);
|
||||
if ($n !== '' && !isset($known[strtolower($n)])) $known[strtolower($n)] = $n;
|
||||
}
|
||||
|
||||
// Rewrites one `NAME=(` … `)` block in place, preserving the leading indent the conf uses.
|
||||
$rewrite = function (string $cur, string $var, array $items): ?string {
|
||||
|
||||
Reference in New Issue
Block a user