mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-29 16:54:06 +02:00
ServiceInfo: provide requiresOverrides()
This commit is contained in:
parent
e4e96206b4
commit
6960407825
@ -65,6 +65,11 @@ class AppliedServiceInfo implements ServiceInfo
|
||||
]);
|
||||
}
|
||||
|
||||
public function requiresOverrides()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
protected static function fetchApplyRulesByServiceName(Db $connection, $serviceName)
|
||||
{
|
||||
$db = $connection->getDbAdapter();
|
||||
|
@ -66,6 +66,11 @@ class AppliedServiceSetServiceInfo implements ServiceInfo
|
||||
]);
|
||||
}
|
||||
|
||||
public function requiresOverrides()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
protected static function fetchServiceSetApplyRulesByServiceName(Db $connection, $serviceName)
|
||||
{
|
||||
$db = $connection->getDbAdapter();
|
||||
|
@ -69,4 +69,9 @@ class InheritedServiceInfo implements ServiceInfo
|
||||
'inheritedFrom' => $this->hostTemplateName
|
||||
]);
|
||||
}
|
||||
|
||||
public function requiresOverrides()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -26,6 +26,11 @@ interface ServiceInfo
|
||||
*/
|
||||
public function getUrl();
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function requiresOverrides();
|
||||
|
||||
/**
|
||||
* @param IcingaHost $host
|
||||
* @param $serviceName
|
||||
|
@ -85,4 +85,9 @@ class ServiceSetServiceInfo implements ServiceInfo
|
||||
'set' => $this->serviceSetName,
|
||||
]);
|
||||
}
|
||||
|
||||
public function requiresOverrides()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -8,23 +8,34 @@ use Icinga\Module\Director\Objects\IcingaService;
|
||||
|
||||
class SingleServiceInfo implements ServiceInfo
|
||||
{
|
||||
/** @var string */
|
||||
protected $hostName;
|
||||
|
||||
/** @var string */
|
||||
protected $serviceName;
|
||||
|
||||
public function __construct($hostName, $serviceName)
|
||||
/** @var bool */
|
||||
protected $useOverrides;
|
||||
|
||||
public function __construct($hostName, $serviceName, $useOverrides)
|
||||
{
|
||||
$this->hostName = $hostName;
|
||||
$this->serviceName= $serviceName;
|
||||
$this->useOverrides = $useOverrides;
|
||||
}
|
||||
|
||||
public static function find(IcingaHost $host, $serviceName)
|
||||
{
|
||||
if (IcingaService::exists([
|
||||
$keyParams = [
|
||||
'host_id' => $host->get('id'),
|
||||
'object_name' => $serviceName
|
||||
], $host->getConnection())) {
|
||||
return new static($host->getObjectName(), $serviceName);
|
||||
];
|
||||
$connection = $host->getConnection();
|
||||
if (IcingaService::exists($keyParams, $connection)) {
|
||||
$useOverrides = IcingaService::load($keyParams, $connection)
|
||||
->getResolvedVar('use_var_overrides') === 'y';
|
||||
|
||||
return new static($host->getObjectName(), $serviceName, $useOverrides);
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -47,4 +58,9 @@ class SingleServiceInfo implements ServiceInfo
|
||||
'service' => $this->serviceName,
|
||||
]);
|
||||
}
|
||||
|
||||
public function requiresOverrides()
|
||||
{
|
||||
return $this->useOverrides;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user