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