mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-29 08:44:11 +02:00
IcingaObject: move duplicate logic to common func
This commit is contained in:
parent
3423ddf605
commit
e96db8b296
@ -1279,15 +1279,7 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$type = $this->getShortTableName();
|
$filename = $this->getRenderingFilename();
|
||||||
|
|
||||||
if ($this->isTemplate()) {
|
|
||||||
$filename = strtolower($type) . '_templates';
|
|
||||||
} elseif ($this->isApplyRule()) {
|
|
||||||
$filename = strtolower($type) . '_apply';
|
|
||||||
} else {
|
|
||||||
$filename = strtolower($type) . 's';
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($config->isLegacy()) {
|
if ($config->isLegacy()) {
|
||||||
|
|
||||||
@ -1333,6 +1325,13 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$config->configFile(
|
||||||
|
'zones.d/' . $this->getRenderingZone($config) . '/' . $this->getRenderingFilename()
|
||||||
|
)->addObject($this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getRenderingFilename()
|
||||||
|
{
|
||||||
$type = $this->getShortTableName();
|
$type = $this->getShortTableName();
|
||||||
|
|
||||||
if ($this->isTemplate()) {
|
if ($this->isTemplate()) {
|
||||||
@ -1343,9 +1342,7 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
|
|||||||
$filename = strtolower($type) . 's';
|
$filename = strtolower($type) . 's';
|
||||||
}
|
}
|
||||||
|
|
||||||
$config->configFile(
|
return $filename;
|
||||||
'zones.d/' . $this->getRenderingZone($config) . '/' . $filename
|
|
||||||
)->addObject($this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getRenderingZone(IcingaConfig $config = null)
|
public function getRenderingZone(IcingaConfig $config = null)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user