diff options
Diffstat (limited to 'lib/chef/chef_fs/file_system/chef_server/organization_invites_entry.rb')
-rw-r--r-- | lib/chef/chef_fs/file_system/chef_server/organization_invites_entry.rb | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/chef/chef_fs/file_system/chef_server/organization_invites_entry.rb b/lib/chef/chef_fs/file_system/chef_server/organization_invites_entry.rb index bcb6b94edf..d852a3bc2e 100644 --- a/lib/chef/chef_fs/file_system/chef_server/organization_invites_entry.rb +++ b/lib/chef/chef_fs/file_system/chef_server/organization_invites_entry.rb @@ -44,15 +44,15 @@ class Chef actual_invites = _read_json.inject({}) { |h, val| h[val["username"]] = val["id"]; h } invites = actual_invites.keys (desired_invites - invites).each do |invite| - begin - rest.post(api_path, { "user" => invite }) - rescue Net::HTTPClientException => e - if e.response.code == "409" - Chef::Log.warn("Could not invite #{invite} to organization #{org}: #{api_error_text(e.response)}") - else - raise - end + + rest.post(api_path, { "user" => invite }) + rescue Net::HTTPClientException => e + if e.response.code == "409" + Chef::Log.warn("Could not invite #{invite} to organization #{org}: #{api_error_text(e.response)}") + else + raise end + end (invites - desired_invites).each do |invite| rest.delete(File.join(api_path, actual_invites[invite])) |