gandi: Whitespace fixes
This commit is contained in:
parent
15595d01ac
commit
2ccdefff93
1 changed files with 14 additions and 21 deletions
35
ddclient.in
35
ddclient.in
|
@ -6908,14 +6908,13 @@ 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) {
|
||||||
$headers .= "Authorization: Bearer $config{$h}{'password'}\n";
|
$headers .= "Authorization: Bearer $config{$h}{'password'}\n";
|
||||||
}
|
}
|
||||||
|
@ -6923,31 +6922,25 @@ 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,
|
||||||
headers => $headers,
|
headers => $headers,
|
||||||
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,17 +6948,16 @@ 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],
|
||||||
});
|
});
|
||||||
$reply = geturl(
|
$reply = geturl(
|
||||||
proxy => opt('proxy'),
|
proxy => opt('proxy'),
|
||||||
url => $url,
|
url => $url,
|
||||||
headers => $headers,
|
headers => $headers,
|
||||||
method => 'PUT',
|
method => 'PUT',
|
||||||
data => $data,
|
data => $data,
|
||||||
);
|
);
|
||||||
$ok = header_ok($h, $reply);
|
$ok = header_ok($h, $reply);
|
||||||
if ($ok) {
|
if ($ok) {
|
||||||
|
@ -6988,6 +6980,7 @@ sub nic_gandi_update {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
## nic_keysystems_examples
|
## nic_keysystems_examples
|
||||||
######################################################################
|
######################################################################
|
||||||
|
|
Loading…
Reference in a new issue