Skip to content

Commit

Permalink
Patch chef_organization lwrp to add all users in members attribute to…
Browse files Browse the repository at this point in the history
… organization when create action is called. Changes needed for cheffish gem to work with lastest chef 12 chef-server-core package.
  • Loading branch information
poliva committed Mar 1, 2015
1 parent 9136eb6 commit 8f78ee6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/chef/provider/chef_organization.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ def whyrun_supported?
new_resource.members.each do |user|
if !existing_members.include?(user)
converge_by "Add #{user} to organization #{new_resource.name}" do
rest.post("#{rest.root_url}/organizations/#{new_resource.name}/users/#{user}", {})
response = rest.post("#{rest.root_url}/organizations/#{new_resource.name}/association_requests", { 'user' => user })
association_id = response["uri"].split("/").last
rest.put("#{rest.root_url}/users/#{user}/association_requests/#{association_id}", { 'response' => 'accept' })
end
end
end
Expand Down

0 comments on commit 8f78ee6

Please sign in to comment.