diff options
author | John Keiser <john@johnkeiser.com> | 2015-09-23 12:48:31 -0700 |
---|---|---|
committer | John Keiser <john@johnkeiser.com> | 2015-09-23 14:08:52 -0700 |
commit | efe6286540a56960e109dcc65db63cc7461c1753 (patch) | |
tree | dad6872cc3c4865fb2e4cf47c08fdfa772c025d0 /lib/chef | |
parent | 2ded4c34fdb2bf8b1f2caa8213cacd022db7084a (diff) | |
download | chef-efe6286540a56960e109dcc65db63cc7461c1753.tar.gz |
Re-upgrade chef-zero to latestjk/latest-chef-zero
Diffstat (limited to 'lib/chef')
-rw-r--r-- | lib/chef/chef_fs/data_handler/client_data_handler.rb | 4 | ||||
-rw-r--r-- | lib/chef/chef_fs/file_system/chef_server_root_dir.rb | 3 | ||||
-rw-r--r-- | lib/chef/chef_fs/file_system/organization_members_entry.rb | 4 |
3 files changed, 7 insertions, 4 deletions
diff --git a/lib/chef/chef_fs/data_handler/client_data_handler.rb b/lib/chef/chef_fs/data_handler/client_data_handler.rb index d81f35e861..5bcbd4e373 100644 --- a/lib/chef/chef_fs/data_handler/client_data_handler.rb +++ b/lib/chef/chef_fs/data_handler/client_data_handler.rb @@ -13,11 +13,13 @@ class Chef 'validator' => false, 'chef_type' => 'client' } + # Handle the fact that admin/validator have changed type from string -> boolean + client['admin'] = (client['admin'] == 'true') if client['admin'].is_a?(String) + client['validator'] = (client['validator'] == 'true') if client['validator'].is_a?(String) if entry.respond_to?(:org) && entry.org defaults['orgname'] = entry.org end result = normalize_hash(client, defaults) - # You can NOT send json_class, or it will fail result.delete('json_class') result end 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 |