add hetzner ip exist check

This commit is contained in:
philippderdiedas 2024-05-25 01:36:17 +00:00
parent 65fb4db6cd
commit f774437235

View file

@ -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