IcingaObject(legacy): Add flag to render only supported objects
refs #12919
This commit is contained in:
parent
2e2f4739c7
commit
31a321e13e
|
@ -29,6 +29,8 @@ class IcingaCommand extends IcingaObject
|
||||||
|
|
||||||
protected $supportsArguments = true;
|
protected $supportsArguments = true;
|
||||||
|
|
||||||
|
protected $supportedInLegacy = true;
|
||||||
|
|
||||||
protected $intervalProperties = array(
|
protected $intervalProperties = array(
|
||||||
'timeout' => 'timeout',
|
'timeout' => 'timeout',
|
||||||
);
|
);
|
||||||
|
|
|
@ -82,6 +82,8 @@ class IcingaHost extends IcingaObject
|
||||||
|
|
||||||
protected $supportsFields = true;
|
protected $supportsFields = true;
|
||||||
|
|
||||||
|
protected $supportedInLegacy = true;
|
||||||
|
|
||||||
public static function enumProperties(
|
public static function enumProperties(
|
||||||
DbConnection $connection = null,
|
DbConnection $connection = null,
|
||||||
$prefix = '',
|
$prefix = '',
|
||||||
|
|
|
@ -51,6 +51,9 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
|
||||||
/** @var bool Whether Sets of object can be defined */
|
/** @var bool Whether Sets of object can be defined */
|
||||||
protected $supportsSets = false;
|
protected $supportsSets = false;
|
||||||
|
|
||||||
|
/** @var bool If the object is rendered in legacy config */
|
||||||
|
protected $supportedInLegacy = false;
|
||||||
|
|
||||||
protected $rangeClass;
|
protected $rangeClass;
|
||||||
|
|
||||||
protected $type;
|
protected $type;
|
||||||
|
@ -1450,6 +1453,10 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
|
||||||
return $config;
|
return $config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function isSupportedInLegacy()
|
||||||
|
{
|
||||||
|
return $this->supportedInLegacy;
|
||||||
|
}
|
||||||
|
|
||||||
public function renderToLegacyConfig(IcingaConfig $config)
|
public function renderToLegacyConfig(IcingaConfig $config)
|
||||||
{
|
{
|
||||||
|
@ -1457,6 +1464,19 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (! $this->isSupportedInLegacy()) {
|
||||||
|
$config->configFile(
|
||||||
|
'director/ignored-objects', '.cfg'
|
||||||
|
)->prepend(
|
||||||
|
sprintf(
|
||||||
|
"# Not supported for legacy config: %s object_name=%s\n",
|
||||||
|
get_class($this),
|
||||||
|
$this->getObjectName()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$filename = $this->getRenderingFilename();
|
$filename = $this->getRenderingFilename();
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
|
|
@ -11,6 +11,8 @@ abstract class IcingaObjectGroup extends IcingaObject
|
||||||
{
|
{
|
||||||
protected $supportsImports = true;
|
protected $supportsImports = true;
|
||||||
|
|
||||||
|
protected $supportedInLegacy = true;
|
||||||
|
|
||||||
protected $defaultProperties = array(
|
protected $defaultProperties = array(
|
||||||
'id' => null,
|
'id' => null,
|
||||||
'object_name' => null,
|
'object_name' => null,
|
||||||
|
|
|
@ -85,6 +85,8 @@ class IcingaService extends IcingaObject
|
||||||
|
|
||||||
protected $supportsSets = true;
|
protected $supportsSets = true;
|
||||||
|
|
||||||
|
protected $supportedInLegacy = true;
|
||||||
|
|
||||||
protected $keyName = array('host_id', 'service_set_id', 'object_name');
|
protected $keyName = array('host_id', 'service_set_id', 'object_name');
|
||||||
|
|
||||||
protected $prioritizedProperties = array('host_id');
|
protected $prioritizedProperties = array('host_id');
|
||||||
|
|
|
@ -28,6 +28,8 @@ class IcingaServiceSet extends IcingaObject
|
||||||
|
|
||||||
protected $supportsApplyRules = true;
|
protected $supportsApplyRules = true;
|
||||||
|
|
||||||
|
protected $supportedInLegacy = true;
|
||||||
|
|
||||||
protected $relations = array(
|
protected $relations = array(
|
||||||
'host' => 'IcingaHost',
|
'host' => 'IcingaHost',
|
||||||
);
|
);
|
||||||
|
|
|
@ -22,6 +22,8 @@ class IcingaTimePeriod extends IcingaObject
|
||||||
|
|
||||||
protected $supportsRanges = true;
|
protected $supportsRanges = true;
|
||||||
|
|
||||||
|
protected $supportedInLegacy = true;
|
||||||
|
|
||||||
protected $relations = array(
|
protected $relations = array(
|
||||||
'zone' => 'IcingaZone',
|
'zone' => 'IcingaZone',
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue