parent
0544b57db4
commit
6687524d2f
|
@ -14,6 +14,9 @@ next (will be 1.8.1)
|
|||
### User Interface
|
||||
* FIX: don't fail when showing a Host overriding multiple inherited groups (#2253)
|
||||
|
||||
### Automation, User Interface
|
||||
* FIX: error message wording on failing related (or parent) object ref (#2224)
|
||||
|
||||
1.8.0
|
||||
-----
|
||||
|
||||
|
|
|
@ -535,7 +535,13 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
|
|||
$this->connection
|
||||
);
|
||||
} catch (NotFoundError $e) {
|
||||
throw new RuntimeException($e->getMessage(), 0, $e);
|
||||
// Hint: eventually a NotFoundError would be better
|
||||
throw new RuntimeException(sprintf(
|
||||
'Unable to load object referenced from %s "%s", %s',
|
||||
$this->getShortTableName(),
|
||||
$this->getObjectName(),
|
||||
lcfirst($e->getMessage())
|
||||
), $e->getCode(), $e);
|
||||
}
|
||||
|
||||
$this->reallySet($name, $object->get('id'));
|
||||
|
|
|
@ -4,6 +4,7 @@ namespace Icinga\Module\Director\Objects;
|
|||
|
||||
use Countable;
|
||||
use Exception;
|
||||
use Icinga\Exception\NotFoundError;
|
||||
use Iterator;
|
||||
use Icinga\Module\Director\IcingaConfig\IcingaConfigHelper as c;
|
||||
use Icinga\Module\Director\IcingaConfig\IcingaConfigRenderer;
|
||||
|
@ -251,14 +252,23 @@ class IcingaObjectImports implements Iterator, Countable, IcingaConfigRenderer
|
|||
$connection = $this->object->getConnection();
|
||||
/** @var IcingaObject $class */
|
||||
$class = $this->getImportClass();
|
||||
if (is_array($this->object->getKeyName())) {
|
||||
// Services only
|
||||
$import = $class::load([
|
||||
'object_name' => $name,
|
||||
'object_type' => 'template'
|
||||
], $connection);
|
||||
} else {
|
||||
$import = $class::load($name, $connection);
|
||||
try {
|
||||
if (is_array($this->object->getKeyName())) {
|
||||
// Services only
|
||||
$import = $class::load([
|
||||
'object_name' => $name,
|
||||
'object_type' => 'template'
|
||||
], $connection);
|
||||
} else {
|
||||
$import = $class::load($name, $connection);
|
||||
}
|
||||
} catch (NotFoundError $e) {
|
||||
throw new NotFoundError(sprintf(
|
||||
'Unable to load parent referenced from %s "%s", %s',
|
||||
$this->object->getShortTableName(),
|
||||
$this->object->getObjectName(),
|
||||
lcfirst($e->getMessage())
|
||||
), $e->getCode(), $e);
|
||||
}
|
||||
|
||||
return $this->objects[$import->getObjectName()] = $import;
|
||||
|
|
Loading…
Reference in New Issue