mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-31 01:34:12 +02:00
CLI/service: fix issues with multi-column key
fixes #12014 fixes #12673
This commit is contained in:
parent
cc722578b6
commit
274e787cb4
@ -3,6 +3,7 @@
|
|||||||
namespace Icinga\Module\Director\Clicommands;
|
namespace Icinga\Module\Director\Clicommands;
|
||||||
|
|
||||||
use Icinga\Module\Director\Cli\ObjectCommand;
|
use Icinga\Module\Director\Cli\ObjectCommand;
|
||||||
|
use Icinga\Module\Director\Objects\IcingaHost;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Manage Icinga Services
|
* Manage Icinga Services
|
||||||
@ -12,4 +13,29 @@ use Icinga\Module\Director\Cli\ObjectCommand;
|
|||||||
*/
|
*/
|
||||||
class ServiceCommand extends ObjectCommand
|
class ServiceCommand extends ObjectCommand
|
||||||
{
|
{
|
||||||
|
|
||||||
|
protected function load($name)
|
||||||
|
{
|
||||||
|
return parent::load($this->makeServiceKey($this->getName()));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function exists($name)
|
||||||
|
{
|
||||||
|
return parent::exists($this->makeServiceKey($this->getName()));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function makeServiceKey($name)
|
||||||
|
{
|
||||||
|
if ($host = $this->params->get('host')) {
|
||||||
|
return array(
|
||||||
|
'object_name' => $name,
|
||||||
|
'host_id' => IcingaHost::load($host, $this->db())->id,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return array(
|
||||||
|
'object_name' => $name,
|
||||||
|
'object_type' => 'template',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user