BasketSnapshot: be explicit, make special Service
...treatment obvious
This commit is contained in:
parent
1d550cd442
commit
591afd441e
|
@ -231,14 +231,6 @@ class BasketSnapshot extends DbObject
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static function classWantsTemplate($class)
|
|
||||||
{
|
|
||||||
return strpos($class, '\\Icinga\\Module\\Director\\Objects\\Icinga') === 0
|
|
||||||
&& strpos($class, 'Choice') === false
|
|
||||||
&& strpos($class, 'Group') === false
|
|
||||||
&& strpos($class, 'Command') === false;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function addAll($typeName)
|
protected function addAll($typeName)
|
||||||
{
|
{
|
||||||
$class = static::getClassForType($typeName);
|
$class = static::getClassForType($typeName);
|
||||||
|
@ -279,9 +271,7 @@ class BasketSnapshot extends DbObject
|
||||||
public static function instanceByIdentifier($typeName, $identifier, Db $connection)
|
public static function instanceByIdentifier($typeName, $identifier, Db $connection)
|
||||||
{
|
{
|
||||||
$class = static::getClassForType($typeName);
|
$class = static::getClassForType($typeName);
|
||||||
if (static::classWantsTemplate($class)
|
if (substr($class, -13) === 'IcingaService') {
|
||||||
&& strpos($class, 'IcingaHost') === false
|
|
||||||
) {
|
|
||||||
$identifier = [
|
$identifier = [
|
||||||
'object_type' => 'template',
|
'object_type' => 'template',
|
||||||
'object_name' => $identifier,
|
'object_name' => $identifier,
|
||||||
|
|
Loading…
Reference in New Issue