mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-28 16:24:05 +02:00
IcingaConfig: respect inheritance for auto-agents
This commit is contained in:
parent
c03aaada92
commit
6e6c2ee6e5
@ -356,15 +356,17 @@ throw $e;
|
|||||||
$zones = array();
|
$zones = array();
|
||||||
$endpoints = array();
|
$endpoints = array();
|
||||||
foreach (IcingaHost::prefetchAll($this->connection) as $host) {
|
foreach (IcingaHost::prefetchAll($this->connection) as $host) {
|
||||||
|
if ($host->object_type !== 'object') continue;
|
||||||
|
if ($host->getResolvedProperty('has_agent') !== 'y') continue;
|
||||||
$name = $host->object_name;
|
$name = $host->object_name;
|
||||||
if ($host->has_agent === 'y') {
|
|
||||||
$props = array(
|
$props = array(
|
||||||
'object_name' => $name,
|
'object_name' => $name,
|
||||||
'object_type' => 'object',
|
'object_type' => 'object',
|
||||||
);
|
);
|
||||||
if ($host->master_should_connect === 'y') {
|
if ($host->getResolvedProperty('master_should_connect') === 'y') {
|
||||||
$props['host'] = $host->address;
|
$props['host'] = $host->getResolvedProperty('address');
|
||||||
$props['zone_id'] = $host->zone_id;
|
$props['zone_id'] = $host->getResolvedProperty('zone_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
$endpoints[] = IcingaEndpoint::create($props);
|
$endpoints[] = IcingaEndpoint::create($props);
|
||||||
@ -372,7 +374,6 @@ throw $e;
|
|||||||
'object_name' => $name
|
'object_name' => $name
|
||||||
))->setEndpointList(array($name));
|
))->setEndpointList(array($name));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
$this->createFileForObjects('endpoint', $endpoints);
|
$this->createFileForObjects('endpoint', $endpoints);
|
||||||
$this->createFileForObjects('zone', $zones);
|
$this->createFileForObjects('zone', $zones);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user