IcingaZone: render endpoints

This commit is contained in:
Thomas Gelf 2015-12-10 11:27:28 +01:00
parent 9c5776bf00
commit 1116bc4331
2 changed files with 28 additions and 0 deletions

View File

@ -818,6 +818,11 @@ return '';
return $this->renderZoneProperty($this->zone_id);
}
protected function renderCustomExtensions()
{
return '';
}
protected function renderObjectHeader()
{
return sprintf(
@ -837,6 +842,7 @@ return '';
$this->renderRanges(),
$this->renderArguments(),
$this->renderGroups(),
$this->renderCustomExtensions(),
$this->renderCustomVars(),
$this->renderSuffix()
));

View File

@ -27,6 +27,28 @@ class IcingaZone extends IcingaObject
protected $supportsImports = true;
protected function renderCustomExtensions()
{
$endpoints = $this->listEndpoints();
if (empty($endpoints)) {
return '';
}
return c::renderKeyValue('endpoints', c::renderArray($endpoints));
}
// TODO: Move this away, should be prefetchable:
protected function listEndpoints()
{
$db = $this->getDb();
$query = $db->select()
->from('icinga_endpoint', 'object_name')
->where('zone_id = ?', $this->id)
->order('object_name');
return $db->fetchCol($query);
}
protected function renderParent_zone_id()
{
return $this->renderRelationProperty(