gandi: Style fixes for readability
This commit is contained in:
parent
2ccdefff93
commit
325eb10536
1 changed files with 5 additions and 13 deletions
18
ddclient.in
18
ddclient.in
|
@ -6907,30 +6907,22 @@ sub nic_gandi_update {
|
||||||
debug("\nnic_gandi_update -------------------");
|
debug("\nnic_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"} or next;
|
||||||
if (!$ip) {
|
|
||||||
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 = "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";
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$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 = "https://$config{$h}{'server'}$config{$h}{'script'}/livedns/domains/$config{$h}{'zone'}/records/$hostname/$rrset_type";
|
||||||
$url = "https://$config{$h}{'server'}$config{$h}{'script'}";
|
|
||||||
$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;
|
||||||
|
|
Loading…
Reference in a new issue