ObjectApplyMatches: resolve imports/templates

fixes #1676
This commit is contained in:
Thomas Gelf 2018-10-15 12:16:35 +02:00
parent 0349a1042a
commit c119c47864
2 changed files with 6 additions and 2 deletions

View File

@ -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);

View File

@ -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);
}
}