mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2026-06-08 16:24:21 -04:00
ObjectImporter, BasketDiff: fallback for baskets...
...with UUID, and no matching entry. Will adjust UUIDs for matching objects
This commit is contained in:
parent
5a732170af
commit
045f4ec941
2 changed files with 6 additions and 4 deletions
|
|
@ -120,8 +120,10 @@ class ObjectImporter
|
|||
*/
|
||||
protected function loadExistingObject(string $implementation, stdClass $plain): ?DbObject
|
||||
{
|
||||
if (isset($plain->uuid)) {
|
||||
return $implementation::loadWithUniqueId(Uuid::fromString($plain->uuid), $this->db);
|
||||
if (isset($plain->uuid)
|
||||
&& $instance = $implementation::loadWithUniqueId(Uuid::fromString($plain->uuid), $this->db)
|
||||
) {
|
||||
return $instance;
|
||||
}
|
||||
|
||||
if ($implementation === IcingaService::class) {
|
||||
|
|
|
|||
|
|
@ -97,8 +97,8 @@ class BasketDiff
|
|||
|
||||
public function getCurrentInstance(string $type, string $key, ?UuidInterface $uuid = null)
|
||||
{
|
||||
if ($uuid) {
|
||||
return BasketSnapshot::instanceByUuid($type, $uuid, $this->db);
|
||||
if ($uuid && $instance = BasketSnapshot::instanceByUuid($type, $uuid, $this->db)) {
|
||||
return $instance;
|
||||
} else {
|
||||
return BasketSnapshot::instanceByIdentifier($type, $key, $this->db);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue