mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-28 08:14:04 +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\Data\Filter\Filter;
|
||||||
use Icinga\Exception\IcingaException;
|
use Icinga\Exception\IcingaException;
|
||||||
|
use Icinga\Exception\ProgrammingError;
|
||||||
use Icinga\Module\Director\Exception\DuplicateKeyException;
|
use Icinga\Module\Director\Exception\DuplicateKeyException;
|
||||||
use Icinga\Module\Director\IcingaConfig\IcingaConfig;
|
use Icinga\Module\Director\IcingaConfig\IcingaConfig;
|
||||||
|
|
||||||
@ -267,6 +268,11 @@ class IcingaServiceSet extends IcingaObject
|
|||||||
|
|
||||||
$name = $this->getObjectName();
|
$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
|
// checking if template object_name is unique
|
||||||
// TODO: Move to IcingaObject
|
// TODO: Move to IcingaObject
|
||||||
if (! $this->hasBeenLoadedFromDb() && $this->isTemplate() && static::exists($name, $this->connection)) {
|
if (! $this->hasBeenLoadedFromDb() && $this->isTemplate() && static::exists($name, $this->connection)) {
|
||||||
|
@ -125,16 +125,12 @@ class IcingaServiceSetTest extends IcingaObjectTestCase
|
|||||||
*/
|
*/
|
||||||
public function testCreatingHostSetWithoutHost()
|
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(
|
$set = IcingaServiceSet::create(array(
|
||||||
'object_name' => '___TEST__set_BAD2',
|
'object_name' => '___TEST__set_BAD2',
|
||||||
'object_type' => 'object',
|
'object_type' => 'object',
|
||||||
));
|
));
|
||||||
|
|
||||||
$set->store($this->getDb());
|
$set->store($this->getDb());
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testDeletingSet()
|
public function testDeletingSet()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user