dyndns2: Treat nochg as good to eliminate duplicate code

This commit is contained in:
Richard Hansen 2024-07-13 04:23:27 -04:00
parent 45e3603918
commit 0882712ec2

View file

@ -4084,6 +4084,10 @@ sub nic_dyndns2_update {
# bug #10: some dyndns providers does not return the IP so # bug #10: some dyndns providers does not return the IP so
# we can't use the returned IP # we can't use the returned IP
my ($status, $returnedips) = split / /, lc $line; my ($status, $returnedips) = split / /, lc $line;
if ($status eq 'nochg') {
warning("updating %s: %s: %s", $hosts, $status, $errors{$status});
$status = 'good';
}
for my $h (@hosts) { for my $h (@hosts) {
$config{$h}{'status-ipv4'} = $status if $ipv4; $config{$h}{'status-ipv4'} = $status if $ipv4;
$config{$h}{'status-ipv6'} = $status if $ipv6; $config{$h}{'status-ipv6'} = $status if $ipv6;
@ -4097,18 +4101,7 @@ sub nic_dyndns2_update {
success("updating %s: %s: IPv4 address set to %s", $hosts, $status, $ipv4) if $ipv4; 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; success("updating %s: %s: IPv6 address set to %s", $hosts, $status, $ipv6) if $ipv6;
} elsif (exists $errors{$status}) { } elsif (exists $errors{$status}) {
if ($status eq 'nochg') { failed("updating %s: %s: %s", $hosts, $status, $errors{$status});
warning("updating %s: %s: %s", $hosts, $status, $errors{$status});
for my $h (@hosts) {
$config{$h}{'ipv4'} = $ipv4 if $ipv4;
$config{$h}{'ipv6'} = $ipv6 if $ipv6;
$config{$h}{'mtime'} = $now;
$config{$h}{'status-ipv4'} = 'good' if $ipv4;
$config{$h}{'status-ipv6'} = 'good' if $ipv6;
}
} else {
failed("updating %s: %s: %s", $hosts, $status, $errors{$status});
}
} elsif ($status =~ /w(\d+)(.)/) { } elsif ($status =~ /w(\d+)(.)/) {
my ($wait, $units) = ($1, lc $2); my ($wait, $units) = ($1, lc $2);
my ($sec, $scale) = ($wait, 1); my ($sec, $scale) = ($wait, 1);