From 9a0279b111803a362c00f342bacfde775eb865f6 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Fri, 24 Jun 2022 10:36:10 +0200 Subject: [PATCH] UuidLookup: do not enforce service objects fixes #2487 fixes #2554 --- doc/82-Changelog.md | 6 ++++++ library/Director/Db/Branch/UuidLookup.php | 9 ++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/doc/82-Changelog.md b/doc/82-Changelog.md index ec66fa43..718df05b 100644 --- a/doc/82-Changelog.md +++ b/doc/82-Changelog.md @@ -11,6 +11,12 @@ v1.10.0 (unreleased) * You can find issues and feature requests related to this release on our [roadmap](https://github.com/Icinga/icingaweb2-module-director/milestone/27?closed=1) +### User Interface +* FIX: links from Service Previews (Icinga DSL) to templates (#2554) + +### REST API +* FIX: addressing service templates by name has been fixed (#2487) + ### CLI * FIX: config deploy doesn't try to wait in case of no deployment (#2522) * FEATURE: improved wording for deployment error messages (#2523) diff --git a/library/Director/Db/Branch/UuidLookup.php b/library/Director/Db/Branch/UuidLookup.php index aa49d3f4..c56996a7 100644 --- a/library/Director/Db/Branch/UuidLookup.php +++ b/library/Director/Db/Branch/UuidLookup.php @@ -8,7 +8,6 @@ use Icinga\Module\Director\Objects\IcingaHost; use Icinga\Module\Director\Objects\IcingaServiceSet; use Ramsey\Uuid\Uuid; use Ramsey\Uuid\UuidInterface; -use RuntimeException; use function is_int; use function is_resource; use function is_string; @@ -22,17 +21,21 @@ class UuidLookup * @param int|string $key * @param IcingaHost|null $host * @param IcingaServiceSet $set + * @return ?UuidInterface */ public static function findServiceUuid( Db $connection, Branch $branch, - $objectType, + $objectType = null, $key = null, IcingaHost $host = null, IcingaServiceSet $set = null ) { $db = $connection->getDbAdapter(); - $query = $db->select()->from('icinga_service', 'uuid')->where('object_type = ?', $objectType); + $query = $db->select()->from('icinga_service', 'uuid'); + if ($objectType) { + $query->where('object_type = ?', $objectType); + } $query = self::addKeyToQuery($connection, $query, $key); if ($host) { $query->where('host_id = ?', $host->get('id'));