IcingaService: fix and simplify command_endpoint

This commit is contained in:
Thomas Gelf 2016-05-10 21:13:07 +02:00
parent 576d62da26
commit bea8988df1
1 changed files with 9 additions and 4 deletions

View File

@ -162,13 +162,18 @@ class IcingaService extends IcingaObject
protected function renderCustomExtensions() protected function renderCustomExtensions()
{ {
if ($this->command_endpoint_id !== null // A hand-crafted command endpoint overrides use_agent
|| $this->object_type !== 'object' if ($this->command_endpoint_id !== null) {
|| $this->getResolvedProperty('use_agent') !== 'y') {
return ''; return '';
} }
if ($this->hasBeenAssignedToHostTemplate()) { // In case use_agent isn't defined, do nothing
// TODO: what if we inherit use_agent and override it with 'n'?
if ($this->use_agent !== 'y') {
return '';
}
if ($this->hasBeenAssignedToHostTemplate() || $this->object_type !== 'object') {
return c::renderKeyValue('command_endpoint', 'host.name'); return c::renderKeyValue('command_endpoint', 'host.name');
} else { } else {
return $this->renderRelationProperty('host', $this->host_id, 'command_endpoint'); return $this->renderRelationProperty('host', $this->host_id, 'command_endpoint');