mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-30 01:04:12 +02:00
IcingaService: blacklisting on Host Templates...
...is now supported fixes #1707
This commit is contained in:
parent
32b71c922c
commit
7da91d747f
@ -21,6 +21,7 @@ before switching to a new version.
|
|||||||
* FIX: Snapshots for Baskets with Dependencies are now possible (#1739)
|
* FIX: Snapshots for Baskets with Dependencies are now possible (#1739)
|
||||||
* FIX: Commands snapshots now carry fields in your Basket (#1747)
|
* FIX: Commands snapshots now carry fields in your Basket (#1747)
|
||||||
* FIX: Cloning services from one Set to another one no longer fails (#1758)
|
* FIX: Cloning services from one Set to another one no longer fails (#1758)
|
||||||
|
* FIX: Blacklisting a Service from a Set on a Host Template is now possible (#1707)
|
||||||
* FEATURE: Add TimePeriod support to Configuration Baskets (#1735)
|
* FEATURE: Add TimePeriod support to Configuration Baskets (#1735)
|
||||||
* FEATURE: RO users could want to see where a configured service originated (#1785)
|
* FEATURE: RO users could want to see where a configured service originated (#1785)
|
||||||
|
|
||||||
|
@ -497,6 +497,7 @@ class IcingaService extends IcingaObject implements ExportInterface
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
|
* @throws \Icinga\Exception\NotFoundError
|
||||||
*/
|
*/
|
||||||
protected function renderCustomExtensions()
|
protected function renderCustomExtensions()
|
||||||
{
|
{
|
||||||
@ -513,16 +514,31 @@ class IcingaService extends IcingaObject implements ExportInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
$blacklist = $this->getBlacklistedHostnames();
|
$blacklist = $this->getBlacklistedHostnames();
|
||||||
if (! empty($blacklist)) {
|
$blacklistedTemplates = [];
|
||||||
if (count($blacklist) === 1) {
|
$blacklistedHosts = [];
|
||||||
|
foreach ($blacklist as $hostname) {
|
||||||
|
if (IcingaHost::load($hostname, $this->connection)->isTemplate()) {
|
||||||
|
$blacklistedTemplates[] = $hostname;
|
||||||
|
} else {
|
||||||
|
$blacklistedHosts[] = $hostname;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foreach ($blacklistedTemplates as $template) {
|
||||||
|
$output .= sprintf(
|
||||||
|
" ignore where %s in host.templates\n",
|
||||||
|
c::renderString($template)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (! empty($blacklistedHosts)) {
|
||||||
|
if (count($blacklistedHosts) === 1) {
|
||||||
$output .= sprintf(
|
$output .= sprintf(
|
||||||
" ignore where host.name == %s\n",
|
" ignore where host.name == %s\n",
|
||||||
c::renderString($blacklist[0])
|
c::renderString($blacklistedHosts[0])
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$output .= sprintf(
|
$output .= sprintf(
|
||||||
" ignore where host.name in %s\n",
|
" ignore where host.name in %s\n",
|
||||||
c::renderArray($blacklist)
|
c::renderArray($blacklistedHosts)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user