Skip to content

Commit

Permalink
Feature #10831, add ignore where in usergroup resource
Browse files Browse the repository at this point in the history
  • Loading branch information
vkhatri committed Dec 30, 2015
1 parent 722967e commit e5c8e6e
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Expand Up @@ -8,6 +8,10 @@ This file is used to list changes made in each version of the icinga2 cookbook.

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

- Van Driessche Vincent - Feature #10831, Adds support to use "assign where" in usergroups

- Virender Khatri - Feature #10831, Adds support to use "ignore where" in usergroups

2.7.0
-----

Expand Down
4 changes: 4 additions & 0 deletions README.md
Expand Up @@ -1050,6 +1050,8 @@ LWRP `usergroup` creates an icinga `UserGroup` object.
display_name 'User Group'
groups ['usergroup']
zone 'zone_name'
assign_where ['assign where statement']
ignore_where ['ignore where statement']
end

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


## LWRP icinga2_zone
Expand Down
10 changes: 9 additions & 1 deletion libraries/resource_usergroup.rb
Expand Up @@ -55,11 +55,19 @@ def template_support(arg = nil)
)
end

def ignore_where(arg = nil)
set_or_return(
:ignore_where, arg,
:kind_of => Array,
:default => nil
)
end

def resource_properties(arg = nil)
set_or_return(
:resource_properties, arg,
:kind_of => Array,
:default => %w(assign_where display_name groups zone)
:default => %w(assign_where ignore_where display_name groups zone)
)
end
end
Expand Down
5 changes: 5 additions & 0 deletions templates/default/object.usergroup.conf.erb
Expand Up @@ -20,6 +20,11 @@ object UserGroup <%= object.inspect -%> {
assign where <%= a %>
<% end -%>
<% end -%>
<% if options['ignore_where'] -%>
<% options['ignore_where'].each do |i| -%>
ignore where <%= i %>
<% end -%>
<% end -%>
}

<% end -%>

0 comments on commit e5c8e6e

Please sign in to comment.