dyndns2: Invert condition to improve readability

This commit is contained in:
Richard Hansen 2024-07-13 04:24:55 -04:00
parent 0882712ec2
commit ad4e3769eb

View file

@ -4092,17 +4092,10 @@ sub nic_dyndns2_update {
$config{$h}{'status-ipv4'} = $status if $ipv4;
$config{$h}{'status-ipv6'} = $status if $ipv6;
}
if ($status eq 'good') {
for my $h (@hosts) {
$config{$h}{'ipv4'} = $ipv4 if $ipv4;
$config{$h}{'ipv6'} = $ipv6 if $ipv6;
$config{$h}{'mtime'} = $now;
}
success("updating %s: %s: IPv4 address set to %s", $hosts, $status, $ipv4) if $ipv4;
success("updating %s: %s: IPv6 address set to %s", $hosts, $status, $ipv6) if $ipv6;
} elsif (exists $errors{$status}) {
if ($status ne 'good') {
if (exists($errors{$status})) {
failed("updating %s: %s: %s", $hosts, $status, $errors{$status});
} elsif ($status =~ /w(\d+)(.)/) {
} elsif ($status =~ qr/w(\d+)(.)/) {
my ($wait, $units) = ($1, lc $2);
my ($sec, $scale) = ($wait, 1);
($scale, $units) = (1, 'seconds') if $units eq 's';
@ -4116,6 +4109,15 @@ sub nic_dyndns2_update {
} else {
failed("updating %s: unexpected status (%s)", $hosts, $line);
}
next;
}
for my $h (@hosts) {
$config{$h}{'ipv4'} = $ipv4 if $ipv4;
$config{$h}{'ipv6'} = $ipv6 if $ipv6;
$config{$h}{'mtime'} = $now;
}
success("updating %s: %s: IPv4 address set to %s", $hosts, $status, $ipv4) if $ipv4;
success("updating %s: %s: IPv6 address set to %s", $hosts, $status, $ipv6) if $ipv6;
}
}