diff --git a/library/Director/Objects/IcingaObject.php b/library/Director/Objects/IcingaObject.php index 74432aa2..0ee80d2a 100644 --- a/library/Director/Objects/IcingaObject.php +++ b/library/Director/Objects/IcingaObject.php @@ -2945,6 +2945,11 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer } } + public function listFlatResolvedImportNames() + { + return $this->templateTree()->getAncestorsFor($this); + } + public function listImportIds() { return $this->templateTree()->listParentIdsFor($this); diff --git a/library/Director/Objects/ObjectApplyMatches.php b/library/Director/Objects/ObjectApplyMatches.php index 84337f38..5ac5abed 100644 --- a/library/Director/Objects/ObjectApplyMatches.php +++ b/library/Director/Objects/ObjectApplyMatches.php @@ -212,9 +212,8 @@ abstract class ObjectApplyMatches $this->object = $object; $this->flatObject = $object->toPlainObject(true, false); // Sure, we are flat - but we might still want to match templates. - // TODO: Flatten the whole tree unset($this->flatObject->imports); - $this->flatObject->templates = $object->imports()->listImportNames(); + $this->flatObject->templates = $object->listFlatResolvedImportNames(); static::flattenVars($this->flatObject); } }