njalla: Update cached status and IP on success
This commit is contained in:
parent
8269021d7b
commit
9573051e3e
1 changed files with 9 additions and 0 deletions
|
@ -5274,10 +5274,12 @@ sub nic_njalla_update {
|
||||||
# Try to get URL
|
# Try to get URL
|
||||||
my $reply = geturl(proxy => opt('proxy'), url => $url);
|
my $reply = geturl(proxy => opt('proxy'), url => $url);
|
||||||
my $response = '';
|
my $response = '';
|
||||||
|
my $status = 'bad';
|
||||||
if ($quietreply) {
|
if ($quietreply) {
|
||||||
$reply =~ qr/invalid host or key/mp;
|
$reply =~ qr/invalid host or key/mp;
|
||||||
$response = ${^MATCH};
|
$response = ${^MATCH};
|
||||||
if (!$response) {
|
if (!$response) {
|
||||||
|
$status = 'good';
|
||||||
success("updating %s: good: IP address set to %s", $h, $ip_output);
|
success("updating %s: good: IP address set to %s", $h, $ip_output);
|
||||||
}
|
}
|
||||||
elsif ($response =~ /invalid host or key/) {
|
elsif ($response =~ /invalid host or key/) {
|
||||||
|
@ -5296,12 +5298,19 @@ sub nic_njalla_update {
|
||||||
if ($response->{status} == 401 && $response->{message} =~ /invalid host or key/) {
|
if ($response->{status} == 401 && $response->{message} =~ /invalid host or key/) {
|
||||||
failed("Invalid host or key");
|
failed("Invalid host or key");
|
||||||
} elsif ($response->{status} == 200 && $response->{message} =~ /record updated/) {
|
} elsif ($response->{status} == 200 && $response->{message} =~ /record updated/) {
|
||||||
|
$status = 'good';
|
||||||
success("updating %s: good: IP address set to %s", $h, $response->{value}->{A});
|
success("updating %s: good: IP address set to %s", $h, $response->{value}->{A});
|
||||||
} else {
|
} else {
|
||||||
failed("Unknown response");
|
failed("Unknown response");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ($status eq 'good') {
|
||||||
|
$config{$h}{'ipv4'} = $ipv4 if $ipv4;
|
||||||
|
$config{$h}{'ipv6'} = $ipv6 if $ipv6;
|
||||||
|
}
|
||||||
|
$config{$h}{'status-ipv4'} = $status if $ipv4;
|
||||||
|
$config{$h}{'status-ipv6'} = $status if $ipv6;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue