legacy/IcingaTimeperiod: Support rendering of excludes

This commit is contained in:
Markus Frosch 2018-09-13 13:57:50 +02:00
parent 0d879c60d3
commit e8c64a422b
2 changed files with 24 additions and 4 deletions

View File

@ -2176,6 +2176,19 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
return $out;
}
/**
* @return string
*/
protected function renderLegacyMultiRelations()
{
$out = '';
foreach ($this->loadAllMultiRelations() as $rel) {
$out .= $rel->toLegacyConfigString();
}
return $out;
}
/**
* @return string
*/
@ -2393,11 +2406,11 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
$this->renderLegacyObjectHeader(),
$this->renderLegacyImports(),
$this->renderLegacyProperties(),
$this->renderLegacyRanges(),
//$this->renderArguments(),
//$this->renderRelatedSets(),
$this->renderLegacyGroups(),
//$this->renderMultiRelations(),
$this->renderLegacyMultiRelations(),
$this->renderLegacyRanges(),
$this->renderLegacyCustomExtensions(),
$this->renderLegacyCustomVars(),
$this->renderLegacySuffix()
@ -2442,11 +2455,11 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
$this->renderPrioritizedProperties(),
$this->renderImports(),
$this->renderProperties(),
$this->renderRanges(),
$this->renderArguments(),
$this->renderRelatedSets(),
$this->renderGroups(),
$this->renderMultiRelations(),
$this->renderRanges(),
$this->renderCustomExtensions(),
$this->renderCustomVars(),
$this->renderSuffix()

View File

@ -30,6 +30,8 @@ class IcingaObjectMultiRelations implements Iterator, Countable, IcingaConfigRen
protected $relatedShortName;
protected $legacyPropertyName;
private $position = 0;
private $db;
@ -439,6 +441,11 @@ class IcingaObjectMultiRelations implements Iterator, Countable, IcingaConfigRen
return '';
}
return c1::renderKeyValue($this->propertyName, c1::renderArray($relations));
if ($this->legacyPropertyName === null) {
return ' # not supported in legacy: ' .
c1::renderKeyValue($this->propertyName, c1::renderArray($relations), '');
}
return c1::renderKeyValue($this->legacyPropertyName, c1::renderArray($relations));
}
}