Skip to content

Commit

Permalink
UuidLookup: do not enforce service objects
Browse files Browse the repository at this point in the history
ref #2487
ref #2554
  • Loading branch information
Thomas-Gelf committed Oct 6, 2022
1 parent 638a359 commit 9e1fc07
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions library/Director/Db/Branch/UuidLookup.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
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;
Expand All @@ -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'));
Expand Down

0 comments on commit 9e1fc07

Please sign in to comment.