added a more verbose error if API key is wrong
This commit is contained in:
parent
c9757ead13
commit
1518deee87
|
@ -2,7 +2,7 @@
|
|||
"name": "24unix/bindapi",
|
||||
"description": "manage Bind9 DNS server via REST API",
|
||||
"version": "1.0.8",
|
||||
"build_number": "353",
|
||||
"build_number": "354",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Micha Espey",
|
||||
|
|
|
@ -725,11 +725,11 @@ class CLIController
|
|||
if (!$this->quiet) {
|
||||
echo COLOR_YELLOW . ' ' . $nameserver->getName();
|
||||
}
|
||||
if (!empty($nameserver->getName())) {
|
||||
if (!empty($nameserver->getA())) {
|
||||
$result = $this->apiController->sendCommand(
|
||||
requestType: 'GET',
|
||||
serverName: $nameserver->getName(),
|
||||
versionIP: 6,
|
||||
versionIP: 4,
|
||||
apiKey: $decryptedKey,
|
||||
command: 'domains/name/' . $domainName,
|
||||
serverType: 'nameserver');
|
||||
|
@ -737,7 +737,7 @@ class CLIController
|
|||
$result = $this->apiController->sendCommand(
|
||||
requestType: 'GET',
|
||||
serverName: $nameserver->getName(),
|
||||
versionIP: 4,
|
||||
versionIP: 6,
|
||||
apiKey: $decryptedKey(),
|
||||
command: 'domains/name/',
|
||||
serverType: 'nameserver' . $domainName);
|
||||
|
@ -749,6 +749,12 @@ class CLIController
|
|||
echo COLOR_GREEN . ' OK';
|
||||
}
|
||||
break;
|
||||
case 401:
|
||||
if (!$this->quiet) {
|
||||
echo COLOR_RED . ' Error: ' . COLOR_YELLOW . $result['data'] . COLOR_DEFAULT . PHP_EOL;
|
||||
}
|
||||
exit(1);
|
||||
break;
|
||||
case 404:
|
||||
if (!$this->quiet) {
|
||||
echo COLOR_RED . ' ' . $result['header'] . COLOR_DEFAULT;
|
||||
|
|
Loading…
Reference in New Issue