IcingaScheduledDowntime: render object header
This commit is contained in:
parent
6f790dd118
commit
e7fc4d3009
|
@ -2,6 +2,9 @@
|
||||||
|
|
||||||
namespace Icinga\Module\Director\Objects;
|
namespace Icinga\Module\Director\Objects;
|
||||||
|
|
||||||
|
use Icinga\Exception\ConfigurationError;
|
||||||
|
use Icinga\Module\Director\IcingaConfig\IcingaConfigHelper as c;
|
||||||
|
|
||||||
class IcingaScheduledDowntime extends IcingaObject
|
class IcingaScheduledDowntime extends IcingaObject
|
||||||
{
|
{
|
||||||
protected $table = 'icinga_scheduled_downtime';
|
protected $table = 'icinga_scheduled_downtime';
|
||||||
|
@ -53,10 +56,30 @@ class IcingaScheduledDowntime extends IcingaObject
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
* @throws ConfigurationError
|
||||||
|
*/
|
||||||
protected function renderObjectHeader()
|
protected function renderObjectHeader()
|
||||||
{
|
{
|
||||||
return parent::renderObjectHeader()
|
if ($this->isApplyRule()) {
|
||||||
. ' import "legacy-timeperiod"' . "\n";
|
if (($to = $this->get('apply_to')) === null) {
|
||||||
|
throw new ConfigurationError(
|
||||||
|
'Applied notification "%s" has no valid object type',
|
||||||
|
$this->getObjectName()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return sprintf(
|
||||||
|
"%s %s %s to %s {\n",
|
||||||
|
$this->getObjectTypeName(),
|
||||||
|
$this->getType(),
|
||||||
|
c::renderString($this->getObjectName()),
|
||||||
|
ucfirst($to)
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return parent::renderObjectHeader();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isActive($now = null)
|
public function isActive($now = null)
|
||||||
|
|
Loading…
Reference in New Issue