From cc48c924aee893f237b43baf8015bc17d8c393d8 Mon Sep 17 00:00:00 2001 From: Julian Brost Date: Tue, 29 Apr 2025 11:10:36 +0200 Subject: [PATCH] Load Notification objects after User and UserGroup Notification objects can refer User and Group objects similar to how they can refer Host and Service objects, so that dependency feels quite natural. Note that for evaluating most configuration, this order doesn't really matter, the configuration will successfully evaluate in either case, the difference can be noticed mainly in more advanced configurations, for example when dynamically assigning user based on their groups. When accessing user objects from the Notification object definition (like in the following example), without this change, only groups configured directly in groups attribute of User objects are visible and those added via assign clauses in UserGroup objects are missing. With this commit, these are also visible. apply Notification "n" to Host { for (var u in get_objects(User)) { log(u.name + " -> " + Json.encode(u.groups)) } # [...] } --- lib/icinga/notification.ti | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/icinga/notification.ti b/lib/icinga/notification.ti index be0784613..a35c4cffb 100644 --- a/lib/icinga/notification.ti +++ b/lib/icinga/notification.ti @@ -22,6 +22,8 @@ class Notification : CustomVarObject < NotificationNameComposer { load_after Host; load_after Service; + load_after User; + load_after UserGroup; [config, protected, required, navigation] name(NotificationCommand) command (CommandRaw) { navigate {{{