mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-31 01:34:12 +02:00
ServiceCommand: extract override-logic
This commit is contained in:
parent
706a9b1fc1
commit
02bed9265a
@ -18,8 +18,16 @@ class ServiceCommand extends ObjectCommand
|
|||||||
public function setAction()
|
public function setAction()
|
||||||
{
|
{
|
||||||
if (($host = $this->params->get('host')) && $this->params->shift('allow-overrides')) {
|
if (($host = $this->params->get('host')) && $this->params->shift('allow-overrides')) {
|
||||||
|
$this->setServiceProperties($host);
|
||||||
|
}
|
||||||
|
|
||||||
|
parent::setAction();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function setServiceProperties($hostname)
|
||||||
|
{
|
||||||
$name = $this->getName();
|
$name = $this->getName();
|
||||||
$host = IcingaHost::load($host, $this->db());
|
$host = IcingaHost::load($hostname, $this->db());
|
||||||
$service = ServiceFinder::find($host, $name);
|
$service = ServiceFinder::find($host, $name);
|
||||||
if ($service->requiresOverrides()) {
|
if ($service->requiresOverrides()) {
|
||||||
$this->params->shift('host');
|
$this->params->shift('host');
|
||||||
@ -58,9 +66,6 @@ class ServiceCommand extends ObjectCommand
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
parent::setAction();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected static function assertVarsForOverrides($properties)
|
protected static function assertVarsForOverrides($properties)
|
||||||
{
|
{
|
||||||
if (empty($properties)) {
|
if (empty($properties)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user