mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-28 00:04:05 +02:00
IcingaServiceSet: do not allow for objects without
...a host
This commit is contained in:
parent
95a971975d
commit
20fe291433
@ -4,6 +4,7 @@ namespace Icinga\Module\Director\Objects;
|
||||
|
||||
use Icinga\Data\Filter\Filter;
|
||||
use Icinga\Exception\IcingaException;
|
||||
use Icinga\Exception\ProgrammingError;
|
||||
use Icinga\Module\Director\Exception\DuplicateKeyException;
|
||||
use Icinga\Module\Director\IcingaConfig\IcingaConfig;
|
||||
|
||||
@ -267,6 +268,11 @@ class IcingaServiceSet extends IcingaObject
|
||||
|
||||
$name = $this->getObjectName();
|
||||
|
||||
if ($this->isObject() && $this->get('host_id') === null) {
|
||||
throw new ProgrammingError(
|
||||
'A Service Set cannot be an object with no related host'
|
||||
);
|
||||
}
|
||||
// checking if template object_name is unique
|
||||
// TODO: Move to IcingaObject
|
||||
if (! $this->hasBeenLoadedFromDb() && $this->isTemplate() && static::exists($name, $this->connection)) {
|
||||
|
@ -125,16 +125,12 @@ class IcingaServiceSetTest extends IcingaObjectTestCase
|
||||
*/
|
||||
public function testCreatingHostSetWithoutHost()
|
||||
{
|
||||
$this->markTestIncomplete('Throws no error currently, but will create the object');
|
||||
|
||||
/* TODO: fix this, it will create an object currently
|
||||
$set = IcingaServiceSet::create(array(
|
||||
'object_name' => '___TEST__set_BAD2',
|
||||
'object_type' => 'object',
|
||||
));
|
||||
|
||||
$set->store($this->getDb());
|
||||
*/
|
||||
}
|
||||
|
||||
public function testDeletingSet()
|
||||
|
Loading…
x
Reference in New Issue
Block a user