godaddy: Fix dubious response body check

It doesn't make sense to continue processing if the response body
can't be parsed.  Maybe GoDaddy returned 200 and there's a bug in the
body parsing logic, in which case the `bad` result should actually be
`good`.  But it's better to assume that the update wasn't saved, in
case the server returns 200 with a JSON object that semantically means
"failed to update".
This commit is contained in:
Richard Hansen 2024-05-18 01:00:19 -04:00
parent f82d2af0f2
commit c63eb0f060

View file

@ -5776,9 +5776,10 @@ sub nic_godaddy_update {
my $msg; my $msg;
$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) && $code != "200") { if (!defined($response)) {
$$status = "bad"; $$status = "bad";
failed("%s.%s -- Unexpected or empty service response, cannot parse data.", $hostname, $zone); failed("%s.%s -- Unexpected or empty service response, cannot parse data.", $hostname, $zone);
next;
} elsif (defined($response->{code})) { } elsif (defined($response->{code})) {
info("%s.%s -- %s - %s.", $hostname, $zone, $response->{code}, $response->{message}); info("%s.%s -- %s - %s.", $hostname, $zone, $response->{code}, $response->{message});
} }