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