gandi: Fix processing of PUT
error responses
Before, the returned JSON wasn't even parsed -- the error handling code was reusing the parsed response from the earlier `GET`. Also, it was reading object properties that were not documented in the Gandi API documentation.
This commit is contained in:
parent
06c3dd5825
commit
0b30df4b69
2 changed files with 7 additions and 7 deletions
|
@ -142,6 +142,8 @@ repository history](https://github.com/ddclient/ddclient/commits/master).
|
||||||
[#719](https://github.com/ddclient/ddclient/pull/719)
|
[#719](https://github.com/ddclient/ddclient/pull/719)
|
||||||
* `yandex`: Errors are now retried.
|
* `yandex`: Errors are now retried.
|
||||||
[#719](https://github.com/ddclient/ddclient/pull/719)
|
[#719](https://github.com/ddclient/ddclient/pull/719)
|
||||||
|
* `gandi`: Fixed handling of error responses.
|
||||||
|
[#721](https://github.com/ddclient/ddclient/pull/721)
|
||||||
|
|
||||||
## 2023-11-23 v3.11.2
|
## 2023-11-23 v3.11.2
|
||||||
|
|
||||||
|
|
12
ddclient.in
12
ddclient.in
|
@ -6952,14 +6952,12 @@ sub nic_gandi_update {
|
||||||
);
|
);
|
||||||
if (!header_ok($h, $reply)) {
|
if (!header_ok($h, $reply)) {
|
||||||
$config{$h}{"status-$ipv"} = "bad";
|
$config{$h}{"status-$ipv"} = "bad";
|
||||||
if (defined($response->{status}) && $response->{status} eq "error") {
|
$reply =~ s/^.*?\n\n//s;
|
||||||
my @errors;
|
my $response = eval { decode_json($reply) };
|
||||||
for my $err (@{$response->{errors}}) {
|
if (ref($response) eq 'HASH' && ($response->{message} // '') ne '') {
|
||||||
push(@errors, $err->{description});
|
failed("$h: $response->{message}");
|
||||||
}
|
|
||||||
failed("$h: " . join(", ", @errors));
|
|
||||||
} else {
|
} else {
|
||||||
failed("$h: unexpected service response");
|
failed("$h: unexpected error response: $reply");
|
||||||
}
|
}
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue