diff --git a/library/Director/Objects/IcingaObject.php b/library/Director/Objects/IcingaObject.php index 6410ca4f..dde7c309 100644 --- a/library/Director/Objects/IcingaObject.php +++ b/library/Director/Objects/IcingaObject.php @@ -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)