PropertyModifierArrayToRow: new modifier

fixes #2192
This commit is contained in:
Thomas Gelf 2020-10-09 11:23:25 +02:00
parent 0568d9d0af
commit 2462fbe18f
2 changed files with 35 additions and 0 deletions

View File

@ -0,0 +1,33 @@
<?php
namespace Icinga\Module\Director\PropertyModifier;
use Icinga\Module\Director\Hook\PropertyModifierHook;
class PropertyModifierArrayToRow extends PropertyModifierHook
{
public function getName()
{
return 'Clone the row for every entry of an Array';
}
public function hasArraySupport()
{
return true;
}
public function expandsRows()
{
return true;
}
public function transform($value)
{
if (empty($value)) {
$this->rejectRow();
return null;
}
return $value;
}
}

View File

@ -18,6 +18,7 @@ use Icinga\Module\Director\Job\ImportJob;
use Icinga\Module\Director\Job\SyncJob;
use Icinga\Module\Director\PropertyModifier\PropertyModifierArrayElementByPosition;
use Icinga\Module\Director\PropertyModifier\PropertyModifierArrayFilter;
use Icinga\Module\Director\PropertyModifier\PropertyModifierArrayToRow;
use Icinga\Module\Director\PropertyModifier\PropertyModifierBitmask;
use Icinga\Module\Director\PropertyModifier\PropertyModifierCombine;
use Icinga\Module\Director\PropertyModifier\PropertyModifierDnsRecords;
@ -79,6 +80,7 @@ $directorHooks = [
'director/PropertyModifier' => [
PropertyModifierArrayElementByPosition::class,
PropertyModifierArrayFilter::class,
PropertyModifierArrayToRow::class,
PropertyModifierBitmask::class,
PropertyModifierCombine::class,
PropertyModifierDnsRecords::class,