mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-30 17:24:18 +02:00
IcingaServiceSet: cleanup, shift responsability...
...for service_set_id property cleanup refs #13049
This commit is contained in:
parent
ba7d350a8c
commit
482f48ee1e
@ -177,6 +177,10 @@ class IcingaService extends IcingaObject
|
||||
|
||||
public function toLegacyConfigString()
|
||||
{
|
||||
if ($this->get('service_set_id')) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if ($this->get('assign_filter')) {
|
||||
return $this->renderLegacyResolvedAssignFilter();
|
||||
}
|
||||
@ -322,11 +326,6 @@ class IcingaService extends IcingaObject
|
||||
return '';
|
||||
}
|
||||
|
||||
public function renderService_set()
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function renderUse_var_overrides()
|
||||
{
|
||||
return '';
|
||||
|
@ -3,10 +3,8 @@
|
||||
namespace Icinga\Module\Director\Objects;
|
||||
|
||||
use Icinga\Data\Filter\Filter;
|
||||
use Icinga\Exception\ProgrammingError;
|
||||
use Icinga\Module\Director\IcingaConfig\IcingaConfig;
|
||||
use Icinga\Module\Director\IcingaConfig\IcingaConfigHelper as c;
|
||||
use Icinga\Module\Director\Objects\IcingaService;
|
||||
|
||||
|
||||
class IcingaServiceSet extends IcingaObject
|
||||
{
|
||||
@ -80,6 +78,7 @@ class IcingaServiceSet extends IcingaObject
|
||||
'id' => $id,
|
||||
'object_type' => 'template'
|
||||
), $connection);
|
||||
$service->set('service_set', null);
|
||||
|
||||
$services[$service->getObjectName()] = $service;
|
||||
}
|
||||
@ -110,7 +109,7 @@ class IcingaServiceSet extends IcingaObject
|
||||
$service->set('assign_filter', $filter);
|
||||
} elseif ($hostId = $this->get('host_id')) {
|
||||
$service->set('object_type', 'object');
|
||||
$service->host_id = $this->host_id;
|
||||
$service->set('host_id', $this->get('host_id'));
|
||||
} else {
|
||||
// Service set template without assign filter or host
|
||||
continue;
|
||||
@ -139,7 +138,7 @@ class IcingaServiceSet extends IcingaObject
|
||||
$comment = "/** Service Set '%s' **/\n\n";
|
||||
}
|
||||
|
||||
return sprintf($comment, $this->object_name);
|
||||
return sprintf($comment, $this->getObjectName());
|
||||
}
|
||||
|
||||
protected function copyVarsToService(IcingaService $service)
|
||||
@ -155,7 +154,7 @@ class IcingaServiceSet extends IcingaObject
|
||||
|
||||
public function renderToLegacyConfig(IcingaConfig $config)
|
||||
{
|
||||
if ($this->assign_filter === null && $this->isTemplate()) {
|
||||
if ($this->get('assign_filter') === null && $this->isTemplate()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -180,7 +179,7 @@ class IcingaServiceSet extends IcingaObject
|
||||
$this->copyVarsToService($service);
|
||||
|
||||
foreach ($hosts as $hostname) {
|
||||
$service->host = $hostname;
|
||||
$service->set('host', $hostname);
|
||||
$file->addLegacyObject($service);
|
||||
}
|
||||
}
|
||||
@ -204,6 +203,5 @@ class IcingaServiceSet extends IcingaObject
|
||||
$host = $this->getRelatedObject('host', $this->get('host_id'));
|
||||
return $host->getRenderingZone($config);
|
||||
}
|
||||
return $zone;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user