Merge pull request #1643 from Icinga/feature/group-apply-should-ignore-templates
GroupMembershipResolver: ignore templates...
This commit is contained in:
commit
e895978ff2
|
@ -82,6 +82,11 @@ abstract class GroupMembershipResolver
|
|||
|
||||
Benchmark::measure('Rechecking all objects');
|
||||
$this->recheckAllObjects($this->getAppliedGroups());
|
||||
if (empty($this->objects)) {
|
||||
Benchmark::measure('Nothing to check, got no qualified object');
|
||||
|
||||
return $this;
|
||||
}
|
||||
Benchmark::measure('Recheck done, loading existing mappings');
|
||||
$this->fetchStoredMappings();
|
||||
Benchmark::measure('Ready, going to store new mappings');
|
||||
|
@ -150,9 +155,11 @@ abstract class GroupMembershipResolver
|
|||
$this->objects = [];
|
||||
}
|
||||
|
||||
$this->objects[$id] = $object;
|
||||
|
||||
$this->includeChildObjects($object);
|
||||
if ($object->isTemplate()) {
|
||||
$this->includeChildObjects($object);
|
||||
} else {
|
||||
$this->objects[$id] = $object;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
@ -172,12 +179,9 @@ abstract class GroupMembershipResolver
|
|||
|
||||
protected function includeChildObjects(IcingaObject $object)
|
||||
{
|
||||
if ($object->get('object_type') !== 'template') {
|
||||
return $this;
|
||||
}
|
||||
|
||||
$query = $this->db->select()
|
||||
->from(['o' => $object->getTableName()]);
|
||||
->from(['o' => $object->getTableName()])
|
||||
->where('o.object_type = ?', 'object');
|
||||
|
||||
IcingaObjectFilterHelper::filterByTemplate(
|
||||
$query,
|
||||
|
@ -467,6 +471,9 @@ abstract class GroupMembershipResolver
|
|||
if ($object->shouldBeRemoved()) {
|
||||
continue;
|
||||
}
|
||||
if ($object->isTemplate()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$mt = microtime(true);
|
||||
$id = $object->get('id');
|
||||
|
|
Loading…
Reference in New Issue