read_recap: Don't copy non-recap values to %config

This commit is contained in:
Richard Hansen 2024-08-28 02:53:18 -04:00
parent 8359eff6ea
commit 70e2b51377
2 changed files with 2 additions and 2 deletions

View file

@ -1636,6 +1636,7 @@ sub read_recap {
$recap{$_} //= {} for keys(%config);
for my $h (keys(%recap)) {
next if !exists($config{$h});
my $vars = $protocols{opt('protocol', $h)}{variables};
# Only status variables are copied from `%recap` into `%config` because the recap should
# not change the configuration. See the documenting comments for `%recap`.
# TODO: Hard-coding this list impairs readability and maintainability. In particular,
@ -1648,6 +1649,7 @@ sub read_recap {
# `$recap{$h}{'status-ipv4'}` directly.
for my $v (qw(atime mtime wtime ipv4 ipv6 status-ipv4 status-ipv6
warned-min-interval warned-min-error-interval)) {
next if !$vars->{$v} || !$vars->{$v}{recap};
if (defined($recap{$h}{$v})) {
$config{$h}{$v} = $recap{$h}{$v};
} else {

View file

@ -143,7 +143,6 @@ my @test_cases = (
cachefile_lines => ["mtime=1234567890 host_b"],
want => {host_b => {host => 'host_b'}},
want_TODO => "longstanding minor issue, doesn't affect functionality",
want_config_changes_TODO => "longstanding bug",
},
{
desc => "non-recap vars are scrubbed from %recap",
@ -151,7 +150,6 @@ my @test_cases = (
recap => {host_b => {host => 'host_b', mtime => 1234567891}},
want => {host_b => {host => 'host_b'}},
want_TODO => "longstanding minor issue, doesn't affect functionality",
want_config_changes_TODO => "longstanding minor issue, doesn't affect functionality",
},
{
desc => "unknown hosts are scrubbed from %recap",