Sync(Rule): Allow to sync services of a ServiceSet
This extends the destination key pattern for Sync. refs #12891
This commit is contained in:
parent
ddd59ab274
commit
8b5689545c
|
@ -349,7 +349,10 @@ class Sync
|
|||
) as $object) {
|
||||
|
||||
if ($object instanceof IcingaService) {
|
||||
if (! $object->host_id) {
|
||||
if (strstr($destinationKeyPattern, '${host}') && $object->host_id === null) {
|
||||
continue;
|
||||
}
|
||||
elseif (strstr($destinationKeyPattern, '${service_set}') && $object->service_set_id === null) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -267,6 +267,9 @@ class SyncRule extends DbObject
|
|||
if ($property->destination_field === 'host') {
|
||||
$hasHost = $property->source_expression;
|
||||
}
|
||||
if ($property->destination_field === 'service_set') {
|
||||
$hasServiceSet = $property->source_expression;
|
||||
}
|
||||
if ($property->destination_field === 'object_name') {
|
||||
$hasObjectName = $property->source_expression;
|
||||
}
|
||||
|
@ -282,6 +285,16 @@ class SyncRule extends DbObject
|
|||
|
||||
$this->destinationKeyPattern = '${host}!${object_name}';
|
||||
}
|
||||
elseif ($hasServiceSet !== false && $hasObjectName !== false) {
|
||||
$this->hasCombinedKey = true;
|
||||
$this->sourceKeyPattern = sprintf(
|
||||
'%s!%s',
|
||||
$hasServiceSet,
|
||||
$hasObjectName
|
||||
);
|
||||
|
||||
$this->destinationKeyPattern = '${service_set}!${object_name}';
|
||||
}
|
||||
} elseif ($this->get('object_type') === 'serviceSet') {
|
||||
$hasHost = false;
|
||||
$hasObjectName = false;
|
||||
|
|
Loading…
Reference in New Issue