From bea8988df1cd6d41c2810bf68d6589eecb5151de Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Tue, 10 May 2016 21:13:07 +0200 Subject: [PATCH] IcingaService: fix and simplify command_endpoint --- library/Director/Objects/IcingaService.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/library/Director/Objects/IcingaService.php b/library/Director/Objects/IcingaService.php index 27168d1f..02834aca 100644 --- a/library/Director/Objects/IcingaService.php +++ b/library/Director/Objects/IcingaService.php @@ -162,13 +162,18 @@ class IcingaService extends IcingaObject protected function renderCustomExtensions() { - if ($this->command_endpoint_id !== null - || $this->object_type !== 'object' - || $this->getResolvedProperty('use_agent') !== 'y') { + // A hand-crafted command endpoint overrides use_agent + if ($this->command_endpoint_id !== null) { 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'); } else { return $this->renderRelationProperty('host', $this->host_id, 'command_endpoint');