mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-29 16:54:06 +02:00
IcingaServiceSet: A simple key identifies a ServiceSet (template)
refs #12891
This commit is contained in:
parent
b08f3df882
commit
ddd59ab274
@ -3,6 +3,7 @@
|
|||||||
namespace Icinga\Module\Director\Objects;
|
namespace Icinga\Module\Director\Objects;
|
||||||
|
|
||||||
use Icinga\Data\Filter\Filter;
|
use Icinga\Data\Filter\Filter;
|
||||||
|
use Icinga\Exception\IcingaException;
|
||||||
use Icinga\Module\Director\IcingaConfig\IcingaConfig;
|
use Icinga\Module\Director\IcingaConfig\IcingaConfig;
|
||||||
|
|
||||||
|
|
||||||
@ -43,6 +44,26 @@ class IcingaServiceSet extends IcingaObject
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function setKey($key)
|
||||||
|
{
|
||||||
|
if (is_int($key)) {
|
||||||
|
$this->id = $key;
|
||||||
|
} elseif (is_string($key)) {
|
||||||
|
$keyComponents = preg_split('~!~', $key);
|
||||||
|
if (count($keyComponents) === 1) {
|
||||||
|
$this->set('object_name', $keyComponents[0]);
|
||||||
|
$this->set('object_type', 'template');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
throw new IcingaException('Can not parse key: %s', $key);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return parent::setKey($key);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return IcingaService[]
|
* @return IcingaService[]
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user