mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-28 16:24:05 +02:00
legacy: Ignore hosts that are disabled or blacklisted properly
This commit is contained in:
parent
a56dacb9c5
commit
b8e00e9b8c
@ -355,14 +355,23 @@ class IcingaService extends IcingaObject implements ExportInterface
|
|||||||
$this->set('object_type', 'object');
|
$this->set('object_type', 'object');
|
||||||
|
|
||||||
foreach ($this->mapHostsToZones($hostnames) as $zone => $names) {
|
foreach ($this->mapHostsToZones($hostnames) as $zone => $names) {
|
||||||
$this->set('host_id', $names);
|
|
||||||
|
|
||||||
$blacklisted = $this->getBlacklistedHostnames();
|
$blacklisted = $this->getBlacklistedHostnames();
|
||||||
$zoneNames = array_diff($names, $blacklisted);
|
$zoneNames = array_diff($names, $blacklisted);
|
||||||
|
|
||||||
|
$disabled = [];
|
||||||
|
foreach ($zoneNames as $name) {
|
||||||
|
if (IcingaHost::load($name, $this->getConnection())->isDisabled()) {
|
||||||
|
$disabled[] = $name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$zoneNames = array_diff($zoneNames, $disabled);
|
||||||
|
|
||||||
if (empty($zoneNames)) {
|
if (empty($zoneNames)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->set('host_id', $zoneNames);
|
||||||
|
|
||||||
$config->configFile('director/' . $zone . '/service_apply', '.cfg')
|
$config->configFile('director/' . $zone . '/service_apply', '.cfg')
|
||||||
->addLegacyObject($this);
|
->addLegacyObject($this);
|
||||||
}
|
}
|
||||||
|
@ -401,6 +401,15 @@ class IcingaServiceSet extends IcingaObject implements ExportInterface
|
|||||||
|
|
||||||
// check if all hosts in the zone ignore this service
|
// check if all hosts in the zone ignore this service
|
||||||
$zoneNames = array_diff($names, $blacklists[$object_name]);
|
$zoneNames = array_diff($names, $blacklists[$object_name]);
|
||||||
|
|
||||||
|
$disabled = [];
|
||||||
|
foreach ($zoneNames as $name) {
|
||||||
|
if (IcingaHost::load($name, $this->getConnection())->isDisabled()) {
|
||||||
|
$disabled[] = $name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$zoneNames = array_diff($zoneNames, $disabled);
|
||||||
|
|
||||||
if (empty($zoneNames)) {
|
if (empty($zoneNames)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user