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