mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-29 00:34:05 +02:00
Import/Sync: add support for 'import' fields
This commit is contained in:
parent
c26f2ed087
commit
19eec671f2
@ -90,6 +90,7 @@ class Sync
|
|||||||
);
|
);
|
||||||
|
|
||||||
$newVars = array();
|
$newVars = array();
|
||||||
|
$imports = array();
|
||||||
|
|
||||||
foreach ($properties as $p) {
|
foreach ($properties as $p) {
|
||||||
if ($p->source_id !== $sourceId) continue;
|
if ($p->source_id !== $sourceId) continue;
|
||||||
@ -100,7 +101,11 @@ class Sync
|
|||||||
if (substr($prop, 0, 5) === 'vars.') {
|
if (substr($prop, 0, 5) === 'vars.') {
|
||||||
$newVars[substr($prop, 5)] = $val;
|
$newVars[substr($prop, 5)] = $val;
|
||||||
} else {
|
} else {
|
||||||
$newProps[$prop] = $val;
|
if ($prop === 'import') {
|
||||||
|
$imports[] = $val;
|
||||||
|
} else {
|
||||||
|
$newProps[$prop] = $val;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,6 +116,9 @@ class Sync
|
|||||||
foreach ($newVars as $prop => $var) {
|
foreach ($newVars as $prop => $var) {
|
||||||
$objects[$key]->vars()->$prop = $var;
|
$objects[$key]->vars()->$prop = $var;
|
||||||
}
|
}
|
||||||
|
if (! empty($imports)) {
|
||||||
|
$objects[$key]->imports()->set($imports);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'merge':
|
case 'merge':
|
||||||
@ -123,6 +131,10 @@ class Sync
|
|||||||
// TODO: property merge policy
|
// TODO: property merge policy
|
||||||
$object->vars()->$prop = $var;
|
$object->vars()->$prop = $var;
|
||||||
}
|
}
|
||||||
|
if (! empty($imports)) {
|
||||||
|
// TODO: merge imports ?!
|
||||||
|
$objects[$key]->imports()->set($imports);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user