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');
|
||||
|
||||
foreach ($this->mapHostsToZones($hostnames) as $zone => $names) {
|
||||
$this->set('host_id', $names);
|
||||
|
||||
$blacklisted = $this->getBlacklistedHostnames();
|
||||
$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)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->set('host_id', $zoneNames);
|
||||
|
||||
$config->configFile('director/' . $zone . '/service_apply', '.cfg')
|
||||
->addLegacyObject($this);
|
||||
}
|
||||
|
|
|
@ -401,6 +401,15 @@ class IcingaServiceSet extends IcingaObject implements ExportInterface
|
|||
|
||||
// check if all hosts in the zone ignore this service
|
||||
$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)) {
|
||||
continue;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue