add hetzner ip exist check
This commit is contained in:
parent
65fb4db6cd
commit
f774437235
1 changed files with 39 additions and 31 deletions
12
ddclient.in
12
ddclient.in
|
|
@ -6401,10 +6401,17 @@ sub nic_hetzner_update {
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
# Pull the ID out of the json, messy
|
# Pull the ID out of the json, messy
|
||||||
my ($dns_rec_id) = map { ($_->{name} eq $hostname && $_->{type} eq $type) ? $_->{id} : ()} @{$response->{records}};
|
my ($dns_rec_id, $current_ip) = map { ($_->{name} eq $hostname && $_->{type} eq $type) ? ($_->{id}, $_->{value}) : ()} @{$response->{records}};
|
||||||
|
|
||||||
# Set domain
|
|
||||||
my $http_method="";
|
my $http_method="";
|
||||||
|
if ($current_ip && $current_ip eq $ip) {
|
||||||
|
info("updating %s %s: IP is already %s, no update needed.", $hostname, $ipv, $ip);
|
||||||
|
$config{$domain}{"ipv$ipv"} = $ip;
|
||||||
|
$config{$domain}{'mtime'} = $now;
|
||||||
|
$config{$domain}{"status-ipv$ipv"} = 'good';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
# Set domain
|
||||||
if ($dns_rec_id)
|
if ($dns_rec_id)
|
||||||
{
|
{
|
||||||
debug("updating %s: DNS '$type' record ID: $dns_rec_id", $domain);
|
debug("updating %s: DNS '$type' record ID: $dns_rec_id", $domain);
|
||||||
|
|
@ -6442,6 +6449,7 @@ sub nic_hetzner_update {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
## nic_yandex_examples
|
## nic_yandex_examples
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue