From efe6286540a56960e109dcc65db63cc7461c1753 Mon Sep 17 00:00:00 2001 From: John Keiser Date: Wed, 23 Sep 2015 12:48:31 -0700 Subject: Re-upgrade chef-zero to latest --- lib/chef/chef_fs/file_system/chef_server_root_dir.rb | 3 ++- lib/chef/chef_fs/file_system/organization_members_entry.rb | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'lib/chef/chef_fs/file_system') diff --git a/lib/chef/chef_fs/file_system/chef_server_root_dir.rb b/lib/chef/chef_fs/file_system/chef_server_root_dir.rb index e3ffd644ad..a243e0ae6b 100644 --- a/lib/chef/chef_fs/file_system/chef_server_root_dir.rb +++ b/lib/chef/chef_fs/file_system/chef_server_root_dir.rb @@ -120,7 +120,8 @@ class Chef if File.dirname(path) == '/organizations' File.basename(path) else - nil + # In Chef 12, everything is in an org. + 'chef' end end end diff --git a/lib/chef/chef_fs/file_system/organization_members_entry.rb b/lib/chef/chef_fs/file_system/organization_members_entry.rb index 94393b341f..40042a9cbc 100644 --- a/lib/chef/chef_fs/file_system/organization_members_entry.rb +++ b/lib/chef/chef_fs/file_system/organization_members_entry.rb @@ -39,9 +39,9 @@ class Chef members = minimize_value(_read_json) (desired_members - members).each do |member| begin - rest.post(File.join(api_path, member), {}) + rest.post(api_path, 'username' => member) rescue Net::HTTPServerException => e - if e.response.code == '404' + if %w(404 405).include?(e.response.code) raise "Chef server at #{api_path} does not allow you to directly add members. Please either upgrade your Chef server or move the users you want into invitations.json instead of members.json." else raise -- cgit v1.2.1