infomaniak: Use variable interpolation instead of sprintf

for readability.
This commit is contained in:
Richard Hansen 2024-07-29 00:44:36 -04:00
parent bb65b64e39
commit 3f0fd0f37b

View file

@ -7320,7 +7320,7 @@ sub nic_infomaniak_update {
for my $v (4, 6) {
my $ip = delete $config{$h}{"wantipv$v"};
if (!defined $ip) {
debug("ipv%d not wanted, skipping", $v);
debug("IPv$v not wanted, skipping");
next;
}
info("setting IP address to %s for %s", $ip, $h);
@ -7331,10 +7331,10 @@ sub nic_infomaniak_update {
# IP changed => good <xxxx::yyyy>
# No domain name => Validation failed
my %statuses = (
'good' => (1, sprintf("IP set to %s for %s", $ip, $h)),
'nochg' => (1, sprintf("IP already set to %s for %s", $ip, $h)),
'nohost' => (0, sprintf("Bad domain name %s or bad IP %s", $h, $ip)),
'badauth' => (0, sprintf("Bad authentication for %s", $h)),
'good' => (1, "IP set to $ip for $h"),
'nochg' => (1, "IP already set to $ip for $h"),
'nohost' => (0, "Bad domain name $h or bad IP $ip"),
'badauth' => (0, "Bad authentication for $h"),
);
my $reply = geturl(
proxy => opt('proxy'),
@ -7346,7 +7346,7 @@ sub nic_infomaniak_update {
(my $body = $reply) =~ s/^.*?\n\n//s;
my ($status) = split(/ /, $body, 2);
my ($ok, $msg) =
$statuses{$status} // (0, sprintf("Unknown reply from Infomaniak: %s", $body));
$statuses{$status} // (0, "Unknown reply from Infomaniak: $body");
if (!$ok) {
failed($msg);
next;