UuidLookup: do not enforce service objects

fixes #2487
fixes #2554
This commit is contained in:
Thomas Gelf 2022-06-24 10:36:10 +02:00
parent 4b229c122c
commit 9a0279b111
2 changed files with 12 additions and 3 deletions

View File

@ -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)

View File

@ -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'));