Merge pull request #734 from rhansen/cache

Don't write undefined recap values to the cache file
This commit is contained in:
Richard Hansen 2024-08-19 17:35:45 -04:00 committed by GitHub
commit 80bbf1dc43
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 1 deletions

View file

@ -127,6 +127,8 @@ repository history](https://github.com/ddclient/ddclient/commits/master).
[#664](https://github.com/ddclient/ddclient/pull/664)
* Fixed "Scalar value better written as" Perl warning.
[#667](https://github.com/ddclient/ddclient/pull/667)
* Fixed "Invalid Value for keyword 'wtime' = ''" warning.
[#734](https://github.com/ddclient/ddclient/pull/734)
* Fixed unnecessary repeated updates for some services.
[#670](https://github.com/ddclient/ddclient/pull/670)
* Fixed DNSExit provider when configured with a zone and non-identical

View file

@ -1535,11 +1535,16 @@ sub write_recap {
$recap{$h}{$v} = opt($v, $h);
}
}
# Clear out entries with `undef` values to avoid needing to figure out how to represent
# `undef` in the cache file and to simplify testing.
for my $v (keys(%{$recap{$h}})) {
delete($recap{$h}{$v}) if !defined($recap{$h}{$v});
}
}
my $recap = "";
for my $h (sort keys %recap) {
my $opt = join(',', map { "$_=" . ($recap{$h}{$_} // '') } sort keys %{$recap{$h}});
my $opt = join(',', map("$_=$recap{$h}{$_}", sort(keys(%{$recap{$h}}))));
$recap .= sprintf "%s%s%s\n", $opt, ($opt ? ' ' : ''), $h;
}