IcingaService: cosmetics, render single hosts...

...with equals, multiple ones as "in array"

refs #907
This commit is contained in:
Thomas Gelf 2018-05-25 19:48:27 +02:00
parent 409661f7d0
commit c3fd50003a

View File

@ -411,11 +411,18 @@ class IcingaService extends IcingaObject
$blacklist = $this->getBlacklistedHostnames(); $blacklist = $this->getBlacklistedHostnames();
if (! empty($blacklist)) { if (! empty($blacklist)) {
if (count($blacklist) === 1) {
$output .= sprintf(
" ignore host.name == %s\n",
c::renderString($blacklist[0])
);
} else {
$output .= sprintf( $output .= sprintf(
" ignore where host.name in %s\n", " ignore where host.name in %s\n",
c::renderArray($blacklist) c::renderArray($blacklist)
); );
} }
}
// A hand-crafted command endpoint overrides use_agent // A hand-crafted command endpoint overrides use_agent
if ($this->command_endpoint_id !== null) { if ($this->command_endpoint_id !== null) {