diff --git a/lib/chef/provider/chef_organization.rb b/lib/chef/provider/chef_organization.rb index e6a8b6a..ab26c81 100644 --- a/lib/chef/provider/chef_organization.rb +++ b/lib/chef/provider/chef_organization.rb @@ -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