godaddy: Invert conditional to improve readability
This commit is contained in:
parent
b1c0029604
commit
6e98c0cdb2
1 changed files with 28 additions and 27 deletions
55
ddclient.in
55
ddclient.in
|
@ -5768,7 +5768,6 @@ sub nic_godaddy_update {
|
||||||
}
|
}
|
||||||
(my $code) = ($reply =~ m%^s*HTTP/.*\s+(\d+)%i);
|
(my $code) = ($reply =~ m%^s*HTTP/.*\s+(\d+)%i);
|
||||||
my $ok = header_ok($h, $reply);
|
my $ok = header_ok($h, $reply);
|
||||||
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)) {
|
if (!defined($response)) {
|
||||||
|
@ -5777,35 +5776,37 @@ sub nic_godaddy_update {
|
||||||
} elsif (defined($response->{code})) {
|
} elsif (defined($response->{code})) {
|
||||||
info("$h: $response->{code} - $response->{message}");
|
info("$h: $response->{code} - $response->{message}");
|
||||||
}
|
}
|
||||||
if ($ok) {
|
if (!$ok) {
|
||||||
$config{$h}{"ipv$ipv"} = $ip;
|
my $msg;
|
||||||
$config{$h}{'mtime'} = $now;
|
if ($code == "400") {
|
||||||
$config{$h}{"status-ipv$ipv"} = 'good';
|
$msg = 'GoDaddy API URL ($url) was malformed.';
|
||||||
success("$h: Updated successfully to $ip (status: $code)");
|
} elsif ($code == "401") {
|
||||||
next;
|
if ($config{$h}{'login'} && $config{$h}{'login'}) {
|
||||||
} elsif ($code == "400") {
|
$msg = 'login or password option incorrect.';
|
||||||
$msg = 'GoDaddy API URL ($url) was malformed.';
|
} else {
|
||||||
} elsif ($code == "401") {
|
$msg = 'login or password option missing.';
|
||||||
if ($config{$h}{'login'} && $config{$h}{'login'}) {
|
}
|
||||||
$msg = 'login or password option incorrect.';
|
$msg .= ' Correct values can be obtained from from https://developer.godaddy.com/keys/.';
|
||||||
|
} elsif ($code == "403") {
|
||||||
|
$msg = 'Customer identified by login and password options denied permission.';
|
||||||
|
} elsif ($code == "404") {
|
||||||
|
$msg = "\"$h\" not found at GoDaddy, please check zone option and login/password.";
|
||||||
|
} elsif ($code == "422") {
|
||||||
|
$msg = "\"$h\" has invalid domain or lacks A/AAAA record.";
|
||||||
|
} elsif ($code == "429") {
|
||||||
|
$msg = 'Too many requests to GoDaddy within brief period.';
|
||||||
|
} elsif ($code == "503") {
|
||||||
|
$msg = "\"$h\" is unavailable.";
|
||||||
} else {
|
} else {
|
||||||
$msg = 'login or password option missing.';
|
$msg = 'Unexpected service response.';
|
||||||
}
|
}
|
||||||
$msg .= ' Correct values can be obtained from from https://developer.godaddy.com/keys/.';
|
failed("$h: $msg");
|
||||||
} elsif ($code == "403") {
|
next;
|
||||||
$msg = 'Customer identified by login and password options denied permission.';
|
|
||||||
} elsif ($code == "404") {
|
|
||||||
$msg = "\"$h\" not found at GoDaddy, please check zone option and login/password.";
|
|
||||||
} elsif ($code == "422") {
|
|
||||||
$msg = "\"$h\" has invalid domain or lacks A/AAAA record.";
|
|
||||||
} elsif ($code == "429") {
|
|
||||||
$msg = 'Too many requests to GoDaddy within brief period.';
|
|
||||||
} elsif ($code == "503") {
|
|
||||||
$msg = "\"$h\" is unavailable.";
|
|
||||||
} else {
|
|
||||||
$msg = 'Unexpected service response.';
|
|
||||||
}
|
}
|
||||||
failed("$h: $msg");
|
$config{$h}{"ipv$ipv"} = $ip;
|
||||||
|
$config{$h}{'mtime'} = $now;
|
||||||
|
$config{$h}{"status-ipv$ipv"} = 'good';
|
||||||
|
success("$h: Updated successfully to $ip (status: $code)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue