diff --git a/application/views/scripts/inspect/object.phtml b/application/views/scripts/inspect/object.phtml deleted file mode 100644 index f023a393..00000000 --- a/application/views/scripts/inspect/object.phtml +++ /dev/null @@ -1,9 +0,0 @@ -
-tabs ?> -
- -
-
-escape($this->renderPlainObject($this->object)) ?>
-
-
diff --git a/application/views/scripts/inspect/type.phtml b/application/views/scripts/inspect/type.phtml deleted file mode 100644 index a69399c6..00000000 --- a/application/views/scripts/inspect/type.phtml +++ /dev/null @@ -1,31 +0,0 @@ -
-tabs ?> -

escape($this->title) ?>

-
- -
-objects): ?> -

translate('%d objects found'), count($this->objects)) ?>

- - - -objects as $object): ?> - - - -
translate('Object name') ?>
qlink( - str_replace('!', ': ', $object), - 'director/inspect/object', - array( - 'endpoint' => $this->endpoint, - 'type' => $this->type->name, - 'plural' => $this->type->plural_name, - 'name' => $object - ) - ) ?>
- -

translate('No object found') ?>

- -

Type attributes

-
renderPlainObject($this->type) ?>
-
diff --git a/application/views/scripts/inspect/types.phtml b/application/views/scripts/inspect/types.phtml deleted file mode 100644 index 9391b5e9..00000000 --- a/application/views/scripts/inspect/types.phtml +++ /dev/null @@ -1,51 +0,0 @@ - $node) { - $html .= '
  • '; - - if ($showLinks || $name === 'ConfigObject') { - $link = $self->qlink( - $name, - 'director/inspect/type', - array('endpoint' => $self->endpoint, 'name' => $name), - array('class' => $node->abstract ? 'abstract' : 'object') - ); - } else { - $link = sprintf( - '%s', - $node->abstract ? 'abstract' : 'object', - $name - ); - } - if (property_exists($node, 'children')) { - $html .= ' '; - $html .= $link; - $html .= ''; - } else { - $html .= $link; - } - $html .= '
  • '; - } - - return $html; -} - -?> -
    -tabs ?> -

    escape($this->title) ?>

    -
    - -
    - -
    diff --git a/library/Director/Core/CoreApi.php b/library/Director/Core/CoreApi.php index 22c565eb..ee32266e 100644 --- a/library/Director/Core/CoreApi.php +++ b/library/Director/Core/CoreApi.php @@ -4,6 +4,7 @@ namespace Icinga\Module\Director\Core; use Exception; use Icinga\Exception\IcingaException; +use Icinga\Exception\NotFoundError; use Icinga\Module\Director\Db; use Icinga\Module\Director\IcingaConfig\IcingaConfig; use Icinga\Module\Director\Objects\IcingaObject; @@ -322,12 +323,16 @@ constants { // TODO: more abstraction needed // TODO: autofetch and cache pluraltypes - $result = $this->client->get( - 'objects/' . $pluralType, - array( - 'attrs' => array('__name') - ) - )->getResult('name'); + try { + $result = $this->client->get( + 'objects/' . $pluralType, + array( + 'attrs' => array('__name') + ) + )->getResult('name'); + } catch (NotFoundError $e) { + $result = []; + } return array_keys($result); } diff --git a/library/Director/Core/RestApiResponse.php b/library/Director/Core/RestApiResponse.php index 253fed1f..481082b6 100644 --- a/library/Director/Core/RestApiResponse.php +++ b/library/Director/Core/RestApiResponse.php @@ -3,6 +3,7 @@ namespace Icinga\Module\Director\Core; use Icinga\Exception\IcingaException; +use Icinga\Exception\NotFoundError; class RestApiResponse { @@ -89,7 +90,11 @@ class RestApiResponse } if (property_exists($result, 'error')) { if (property_exists($result, 'status')) { - throw new IcingaException('API request failed: ' . $result->status); + if ((int) $result->error === 404) { + throw new NotFoundError($result->status); + } else { + throw new IcingaException('API request failed: ' . $result->status); + } } else { throw new IcingaException('API request failed: ' . var_export($result, 1)); }