IcingaObject(legacy): Only render passive objects for checkables

Also simplify renderToLegacyConfig.

refs #12919
This commit is contained in:
Markus Frosch 2016-10-13 15:22:15 +02:00
parent c32cc3ca92
commit 2e2f4739c7
1 changed files with 14 additions and 29 deletions

View File

@ -1459,38 +1459,23 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
$filename = $this->getRenderingFilename();
if ($config->isLegacy()) {
if (
$this->getResolvedProperty('zone_id')
&& array_key_exists('enable_active_checks', $this->defaultProperties)
) {
$passive = clone($this);
$passive->enable_active_checks = false;
if ($this->getResolvedProperty('zone_id')) {
$a = clone($this);
$a->set('enable_active_checks', true);
$b = clone($this);
$a->set('enable_active_checks', false);
$config->configFile(
'director/master/' . $filename,
'.cfg'
)->addLegacyObject($a);
$config->configFile(
'director/' . $this->getRenderingZone($config) . '/' . $filename,
'.cfg'
)->addLegacyObject($b);
} else {
$config->configFile(
'director/' . $this->getRenderingZone($config) . '/' . $filename,
'.cfg'
)->addLegacyObject($this);
}
} else {
$config->configFile(
'director/' . $this->getRenderingZone($config) . '/' . $filename
)->addObject($this);
'director/master/' . $filename,
'.cfg'
)->addLegacyObject($passive);
}
$config->configFile(
'director/' . $this->getRenderingZone($config) . '/' . $filename,
'.cfg'
)->addLegacyObject($this);
}
public function renderToConfig(IcingaConfig $config)