A partner's conf is in the RAM cache, not CONF_DIR, and a commented-out template entry is not configuration

This commit is contained in:
Gmer4Lfe
2026-08-22 01:06:24 -04:00
parent a89b704fa1
commit 13c221244e
3 changed files with 35 additions and 3 deletions
+10 -2
View File
@@ -138,7 +138,15 @@ function vv_wd_bash_assoc(string $raw, string $varname): array {
// declare -A VARNAME=( ["key"]=val ["key2"]=val2 )
if (!preg_match('/^\s*declare\s+-A\s+' . preg_quote($varname, '/') . '\s*=\s*\(\s*(.*?)\s*\)/ms', $raw, $m))
return [];
preg_match_all('/\["([^"]+)"\]\s*=\s*"?([^"\s\)]*)"?/', $m[1], $pairs);
// Strip comments before matching, from # to end of line. Without this a commented-out
// template entry — `# ["Emby"]=18432`, which is how every host*.conf ships — parses as a
// live memory limit. It never showed on this host because this host's entries are real; it
// appeared the moment a PARTNER's conf became readable and its whole commented block was
// read as configuration. Cut per line, so a trailing comment on a real entry still keeps it:
// `["Emby"]=24576 # 24GB — raised 2026-07-11` must survive. vv_parse_bash_array(), which
// the list form delegates to, has always done this.
$body = preg_replace('/#.*$/m', '', $m[1]);
preg_match_all('/\["([^"]+)"\]\s*=\s*"?([^"\s\)]*)"?/', $body, $pairs);
$out = [];
foreach ($pairs[1] as $i => $k) $out[$k] = $pairs[2][$i];
return $out;
@@ -560,7 +568,7 @@ function vv_wd_all(): array {
// "No data" while HOST2's own page showed the same watchdogs reporting OK.
$ts = vv_pt_peer_lookup($tsPeers, $hostname);
$ip = $ts['ip'] ?? null;
$raw = vv_read_conf_raw($slot . '.conf');
$raw = vv_read_host_conf_raw($slot); // partner conf lives in the RAM cache, not CONF_DIR
$remoteApiKey = vv_wd_scalar($raw, strtoupper($slot) . '_UNRAID_API_KEY');