Skip to content
This repository has been archived by the owner on Nov 6, 2024. It is now read-only.

Commit

Permalink
Adds support to use "assign where" in usergroups
Browse files Browse the repository at this point in the history
  • Loading branch information
vncntvandriessche committed Dec 14, 2015
1 parent 6e19cd0 commit cd2155e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
10 changes: 9 additions & 1 deletion libraries/resource_usergroup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ def initialize(name, run_context = nil)
@name = name
end

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

def display_name(arg = nil)
set_or_return(
:display_name, arg,
Expand Down Expand Up @@ -51,7 +59,7 @@ def resource_properties(arg = nil)
set_or_return(
:resource_properties, arg,
:kind_of => Array,
:default => %w(display_name groups zone)
:default => %w(assign_where display_name groups zone)
)
end
end
Expand Down
5 changes: 5 additions & 0 deletions templates/default/object.usergroup.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ object UserGroup <%= object.inspect -%> {
<% if options['groups'] && !options['groups'].empty? -%>
groups = <%= options['groups'].sort.uniq.inspect %>
<% end -%>
<% if options['assign_where'] -%>
<%- options['assign_where'].each do |a|-%>
assign where <%= a %>
<% end -%>
<% end -%>
}

<% end -%>

0 comments on commit cd2155e

Please sign in to comment.