Sync: load object w/o branch support the old way

fixes #2618
This commit is contained in:
Thomas Gelf 2022-10-06 13:08:48 +02:00
parent 3c2815d2e9
commit f447457c40
2 changed files with 5 additions and 2 deletions

View File

@ -13,6 +13,7 @@ v1.10.1 (unreleased)
### Import and Sync ### Import and Sync
* FIX: sync lower-cased all object names since v1.10 (#2608) * FIX: sync lower-cased all object names since v1.10 (#2608)
* FIX: sync for Datalist entries has been fixed (#2618)
### UI ### UI
* FIX: "Modify" Services via the monitoring module (#2615, #2619) * FIX: "Modify" Services via the monitoring module (#2615, #2619)

View File

@ -10,6 +10,7 @@ use Icinga\Module\Director\Data\Db\DbObject;
use Icinga\Module\Director\Data\Db\DbObjectStore; use Icinga\Module\Director\Data\Db\DbObjectStore;
use Icinga\Module\Director\Data\Db\DbObjectTypeRegistry; use Icinga\Module\Director\Data\Db\DbObjectTypeRegistry;
use Icinga\Module\Director\Db; use Icinga\Module\Director\Db;
use Icinga\Module\Director\Db\Branch\BranchSupport;
use Icinga\Module\Director\Db\Cache\PrefetchCache; use Icinga\Module\Director\Db\Cache\PrefetchCache;
use Icinga\Module\Director\Objects\HostGroupMembershipResolver; use Icinga\Module\Director\Objects\HostGroupMembershipResolver;
use Icinga\Module\Director\Objects\IcingaHost; use Icinga\Module\Director\Objects\IcingaHost;
@ -406,8 +407,9 @@ class Sync
if ($this->rule->hasCombinedKey()) { if ($this->rule->hasCombinedKey()) {
$this->objects = []; $this->objects = [];
$destinationKeyPattern = $this->rule->getDestinationKeyPattern(); $destinationKeyPattern = $this->rule->getDestinationKeyPattern();
if ($this->store) { $table = DbObjectTypeRegistry::tableNameByType($ruleObjectType);
$objects = $this->store->loadAll(DbObjectTypeRegistry::tableNameByType($ruleObjectType)); if ($this->store && BranchSupport::existsForTableName($table)) {
$objects = $this->store->loadAll($table);
} else { } else {
$objects = IcingaObject::loadAllByType($ruleObjectType, $this->db); $objects = IcingaObject::loadAllByType($ruleObjectType, $this->db);
} }