Skip to content

Commit e5c8e6e

Browse files
committed
Feature #10831, add ignore where in usergroup resource
1 parent 722967e commit e5c8e6e

File tree

4 files changed

+22
-1
lines changed

4 files changed

+22
-1
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ This file is used to list changes made in each version of the icinga2 cookbook.
88

99
- Virender Khatri - Feature #10900, fix to allow multiple environment resources for an environment
1010

11+
- Van Driessche Vincent - Feature #10831, Adds support to use "assign where" in usergroups
12+
13+
- Virender Khatri - Feature #10831, Adds support to use "ignore where" in usergroups
14+
1115
2.7.0
1216
-----
1317

README.md

+4
Original file line numberDiff line numberDiff line change
@@ -1050,6 +1050,8 @@ LWRP `usergroup` creates an icinga `UserGroup` object.
10501050
display_name 'User Group'
10511051
groups ['usergroup']
10521052
zone 'zone_name'
1053+
assign_where ['assign where statement']
1054+
ignore_where ['ignore where statement']
10531055
end
10541056

10551057
Above LWRP resource will create an icinga `UserGroup` object.
@@ -1061,6 +1063,8 @@ Above LWRP resource will create an icinga `UserGroup` object.
10611063
- *display_name* (optional, String) - icinga `UserGroup` attribute `display_name`
10621064
- *groups* (optional, Array) - icinga `UserGroup` attribute `groups`
10631065
- *zone* (optional, String) - icinga `UserGroup` attribute `zone`
1066+
- *assign_where* (optional, Array) - an array of `assign where` statements
1067+
- *ignore_where* (optional, Array) - an array of `ignore where` statements
10641068

10651069

10661070
## LWRP icinga2_zone

libraries/resource_usergroup.rb

+9-1
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,19 @@ def template_support(arg = nil)
5555
)
5656
end
5757

58+
def ignore_where(arg = nil)
59+
set_or_return(
60+
:ignore_where, arg,
61+
:kind_of => Array,
62+
:default => nil
63+
)
64+
end
65+
5866
def resource_properties(arg = nil)
5967
set_or_return(
6068
:resource_properties, arg,
6169
:kind_of => Array,
62-
:default => %w(assign_where display_name groups zone)
70+
:default => %w(assign_where ignore_where display_name groups zone)
6371
)
6472
end
6573
end

templates/default/object.usergroup.conf.erb

+5
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ object UserGroup <%= object.inspect -%> {
2020
assign where <%= a %>
2121
<% end -%>
2222
<% end -%>
23+
<% if options['ignore_where'] -%>
24+
<% options['ignore_where'].each do |i| -%>
25+
ignore where <%= i %>
26+
<% end -%>
27+
<% end -%>
2328
}
2429

2530
<% end -%>

0 commit comments

Comments
 (0)