gandi: Whitespace fixes

This commit is contained in:
Richard Hansen 2024-07-28 00:30:15 -04:00
parent 15595d01ac
commit 2ccdefff93

View file

@ -6908,12 +6908,11 @@ sub nic_gandi_update {
for my $h (@_) {
for my $ipv ('ipv4', 'ipv6') {
my $ip = delete $config{$h}{"want$ipv"};
if(!$ip) {
if (!$ip) {
next;
}
(my $hostname = $h) =~ s/\.\Q$config{$h}{zone}\E$//;
info("%s -- Setting IP address to %s.", $h, $ip);
my $headers;
$headers = "Content-Type: application/json\n";
if ($config{$h}{'use-personal-access-token'} == 1) {
@ -6923,14 +6922,10 @@ sub nic_gandi_update {
{
$headers .= "Authorization: Apikey $config{$h}{'password'}\n";
}
my $rrset_type = $ipv eq 'ipv6' ? 'AAAA' : 'A';
my $url;
$url = "https://$config{$h}{'server'}$config{$h}{'script'}";
$url .= "/livedns/domains/$config{$h}{'zone'}/records/$hostname/$rrset_type";
my $reply = geturl(
proxy => opt('proxy'),
url => $url,
@ -6938,16 +6933,14 @@ sub nic_gandi_update {
method => 'GET'
);
my $ok = header_ok($h, $reply);
$reply =~ s/^.*?\n\n//s;
my $response = eval { decode_json($reply) };
if (!defined($response)) {
$config{$h}{"status-$ipv"} = "bad";
failed("%s -- Unexpected service response.", $h);
next;
}
if($response->{'rrset_values'}->[0] eq $ip && (!defined($config{$h}{'ttl'}) ||
if ($response->{'rrset_values'}->[0] eq $ip && (!defined($config{$h}{'ttl'}) ||
$response->{'rrset_ttl'} eq $config{$h}{'ttl'})) {
$config{$h}{'ip'} = $ip;
$config{$h}{'mtime'} = $now;
@ -6955,7 +6948,6 @@ sub nic_gandi_update {
success("updating %s: skipped: address was already set to %s.", $h, $ip);
next;
}
my $data = encode_json({
defined($config{$h}{'ttl'}) ? (rrset_ttl => $config{$h}{'ttl'}) : (),
rrset_values => [$ip],
@ -6988,6 +6980,7 @@ sub nic_gandi_update {
}
}
}
######################################################################
## nic_keysystems_examples
######################################################################