duckdns: Invert condition to improve readability

This commit is contained in:
Richard Hansen 2024-07-21 20:00:01 -04:00
parent 91fd9e3842
commit 1eccfb8c77

View file

@ -6360,19 +6360,19 @@ sub nic_duckdns_update {
next; next;
}; };
chomp($body); chomp($body);
if ($body eq 'OK') { if ($body ne 'OK') {
$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;
success("updating %s: good: IPv4 address set to %s", $h, $ipv4) if $ipv4;
success("updating %s: good: IPv6 address set to %s", $h, $ipv6) if $ipv6;
} else {
$config{$h}{'status-ipv4'} = 'failed' if $ipv4; $config{$h}{'status-ipv4'} = 'failed' if $ipv4;
$config{$h}{'status-ipv6'} = 'failed' if $ipv6; $config{$h}{'status-ipv6'} = 'failed' if $ipv6;
failed("updating %s: Server said: '%s'", $h, $body); failed("updating %s: Server said: '%s'", $h, $body);
next;
} }
$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;
success("updating %s: good: IPv4 address set to %s", $h, $ipv4) if $ipv4;
success("updating %s: good: IPv6 address set to %s", $h, $ipv6) if $ipv6;
} }
} }