IcingaService: handle use_agent=n by explicitly...

...rendering command_endpoint = null

fixes #921
fixes #1013
This commit is contained in:
Thomas Gelf 2017-08-25 08:50:38 +02:00
parent e05c3a8556
commit 5450a00c78
2 changed files with 6 additions and 6 deletions

View File

@ -125,7 +125,7 @@ class IcingaHost extends IcingaObject
$hostVars = array();
if ($connection !== null) {
if ($connection instanceof Db) {
foreach ($connection->fetchDistinctHostVars() as $var) {
if ($filter->match(PropertiesFilter::$CUSTOM_PROPERTY, $var->varname, $var)) {
if ($var->datatype) {

View File

@ -346,13 +346,13 @@ class IcingaService extends IcingaObject
return $output;
}
// 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') {
if ($this->use_agent === 'y') {
return $output . c::renderKeyValue('command_endpoint', 'host_name');
} elseif ($this->use_agent === 'n') {
return $output . c::renderKeyValue('command_endpoint', c::renderPhpValue(null));
} else {
return $output;
}
return $output . c::renderKeyValue('command_endpoint', 'host_name');
}
/**