mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-28 16:24:05 +02:00
Sync: fix datalist entry sync
This commit is contained in:
parent
ef1079e600
commit
ad39da9a13
@ -277,9 +277,28 @@ class Sync
|
|||||||
$objects = IcingaObject::loadAllByType($rule->object_type, $db);
|
$objects = IcingaObject::loadAllByType($rule->object_type, $db);
|
||||||
|
|
||||||
if ($rule->object_type === 'datalistEntry') {
|
if ($rule->object_type === 'datalistEntry') {
|
||||||
|
$listId = null;
|
||||||
|
foreach ($properties as $prop) {
|
||||||
|
if ($prop->destination_field === 'list_id') {
|
||||||
|
$listId = (int) $prop->source_expression;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($listId === null) {
|
||||||
|
throw new IcingaException(
|
||||||
|
'Cannot sync datalist entry without list_ist'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
$no = array();
|
$no = array();
|
||||||
foreach ($objects as $o) {
|
foreach ($objects as $k => $o) {
|
||||||
// if ($o->list_id !== $source->
|
if ($o->list_id !== $listId) {
|
||||||
|
$no[] = $k;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($no as $k) {
|
||||||
|
unset($objects[$k]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$objectKey = $rule->object_type === 'datalistEntry' ? 'entry_name' : 'object_name';
|
$objectKey = $rule->object_type === 'datalistEntry' ? 'entry_name' : 'object_name';
|
||||||
@ -447,7 +466,9 @@ class Sync
|
|||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ($object->shouldBeRemoved()) {
|
|
||||||
|
// TODO: introduce DirectorObject with shouldBeRemoved
|
||||||
|
if ($object instanceof IcingaObject && $object->shouldBeRemoved()) {
|
||||||
$object->delete($db);
|
$object->delete($db);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user