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 $ok = header_ok($h, $reply);
|
||||
my $msg;
|
||||
$reply =~ s/^.*?\n\n//s;
|
||||
my $response = eval {decode_json($reply)};
|
||||
if (!defined($response)) {
|
||||
|
@ -5777,35 +5776,37 @@ sub nic_godaddy_update {
|
|||
} elsif (defined($response->{code})) {
|
||||
info("$h: $response->{code} - $response->{message}");
|
||||
}
|
||||
if ($ok) {
|
||||
$config{$h}{"ipv$ipv"} = $ip;
|
||||
$config{$h}{'mtime'} = $now;
|
||||
$config{$h}{"status-ipv$ipv"} = 'good';
|
||||
success("$h: Updated successfully to $ip (status: $code)");
|
||||
next;
|
||||
} elsif ($code == "400") {
|
||||
$msg = 'GoDaddy API URL ($url) was malformed.';
|
||||
} elsif ($code == "401") {
|
||||
if ($config{$h}{'login'} && $config{$h}{'login'}) {
|
||||
$msg = 'login or password option incorrect.';
|
||||
if (!$ok) {
|
||||
my $msg;
|
||||
if ($code == "400") {
|
||||
$msg = 'GoDaddy API URL ($url) was malformed.';
|
||||
} elsif ($code == "401") {
|
||||
if ($config{$h}{'login'} && $config{$h}{'login'}) {
|
||||
$msg = 'login or password option incorrect.';
|
||||
} else {
|
||||
$msg = 'login or password option missing.';
|
||||
}
|
||||
$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 {
|
||||
$msg = 'login or password option missing.';
|
||||
$msg = 'Unexpected service response.';
|
||||
}
|
||||
$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 {
|
||||
$msg = 'Unexpected service response.';
|
||||
failed("$h: $msg");
|
||||
next;
|
||||
}
|
||||
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