Skip to content

Instantly share code, notes, and snippets.

@lazyfrosch
Created February 20, 2020 09:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lazyfrosch/cc5c3bc29922e530139235bbd031aceb to your computer and use it in GitHub Desktop.
Save lazyfrosch/cc5c3bc29922e530139235bbd031aceb to your computer and use it in GitHub Desktop.
Icinga Director Hack to allow ServiceSet Import of templates (the service sets themselve)
diff --git a/library/Director/Objects/ImportSource.php b/library/Director/Objects/ImportSource.php
index a58aa195..e9b115c5 100644
--- a/library/Director/Objects/ImportSource.php
+++ b/library/Director/Objects/ImportSource.php
@@ -119,7 +119,7 @@ class ImportSource extends DbObjectWithSettings implements ExportInterface
$this->loadedRowModifiers = $this->fetchRowModifiers();
}
$current = $this->loadedRowModifiers;
- if ($current !== null && count($current) !== count($modifiers)) {
+ if (empty($current) || count($current) !== count($modifiers)) {
$this->newRowModifiers = $modifiers;
} else {
$i = 0;
diff --git a/library/Director/Objects/SyncRule.php b/library/Director/Objects/SyncRule.php
index cb04b179..ee6a9785 100644
--- a/library/Director/Objects/SyncRule.php
+++ b/library/Director/Objects/SyncRule.php
@@ -449,6 +449,13 @@ class SyncRule extends DbObject implements ExportInterface
);
$this->destinationKeyPattern = '${host}!${object_name}';
+ } else {
+ $this->hasCombinedKey = true;
+ $this->sourceKeyPattern = sprintf(
+ '!%s',
+ $hasObjectName
+ );
+ $this->destinationKeyPattern = '!${object_name}';
}
} elseif ($this->get('object_type') === 'datalistEntry') {
$hasList = false;
@lazyfrosch
Copy link
Author

This won't allow purging!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment