summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Gemfile4
-rw-r--r--lib/chef/chef_fs/data_handler/client_data_handler.rb4
-rw-r--r--lib/chef/chef_fs/file_system/chef_server_root_dir.rb3
-rw-r--r--lib/chef/chef_fs/file_system/organization_members_entry.rb4
-rw-r--r--spec/integration/knife/download_spec.rb4
-rw-r--r--spec/integration/knife/list_spec.rb8
-rw-r--r--spec/integration/knife/upload_spec.rb2
7 files changed, 20 insertions, 9 deletions
diff --git a/Gemfile b/Gemfile
index edbd853c47..2b135fb8e8 100644
--- a/Gemfile
+++ b/Gemfile
@@ -5,10 +5,6 @@ gem "activesupport", "< 4.0.0", :group => :compat_testing, :platform => "ruby"
gem 'chef-config', path: "chef-config"
-# We are pinning chef-zero to 4.2.x until ChefFS can deal
-# with V1 api calls or chef-zero supports both v0 and v1
-gem "chef-zero", "~> 4.2.3"
-
group(:docgen) do
gem "yard"
end
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
diff --git a/spec/integration/knife/download_spec.rb b/spec/integration/knife/download_spec.rb
index c87e6fe20a..8842ed5ac4 100644
--- a/spec/integration/knife/download_spec.rb
+++ b/spec/integration/knife/download_spec.rb
@@ -1113,11 +1113,13 @@ Created /acls/clients/foo-validator.json
Created /acls/containers
Created /acls/containers/clients.json
Created /acls/containers/containers.json
+Created /acls/containers/cookbook_artifacts.json
Created /acls/containers/cookbooks.json
Created /acls/containers/data.json
Created /acls/containers/environments.json
Created /acls/containers/groups.json
Created /acls/containers/nodes.json
+Created /acls/containers/policies.json
Created /acls/containers/roles.json
Created /acls/containers/sandboxes.json
Created /acls/containers/x.json
@@ -1139,11 +1141,13 @@ Created /clients/foo-validator.json
Created /containers
Created /containers/clients.json
Created /containers/containers.json
+Created /containers/cookbook_artifacts.json
Created /containers/cookbooks.json
Created /containers/data.json
Created /containers/environments.json
Created /containers/groups.json
Created /containers/nodes.json
+Created /containers/policies.json
Created /containers/roles.json
Created /containers/sandboxes.json
Created /containers/x.json
diff --git a/spec/integration/knife/list_spec.rb b/spec/integration/knife/list_spec.rb
index 911b56ef18..b289642c7d 100644
--- a/spec/integration/knife/list_spec.rb
+++ b/spec/integration/knife/list_spec.rb
@@ -702,11 +702,13 @@ foo-validator.json
/acls/containers:
clients.json
containers.json
+cookbook_artifacts.json
cookbooks.json
data.json
environments.json
groups.json
nodes.json
+policies.json
roles.json
sandboxes.json
@@ -733,11 +735,13 @@ foo-validator.json
/containers:
clients.json
containers.json
+cookbook_artifacts.json
cookbooks.json
data.json
environments.json
groups.json
nodes.json
+policies.json
roles.json
sandboxes.json
@@ -804,11 +808,13 @@ foo-validator.json
/acls/containers:
clients.json
containers.json
+cookbook_artifacts.json
cookbooks.json
data.json
environments.json
groups.json
nodes.json
+policies.json
roles.json
sandboxes.json
@@ -835,11 +841,13 @@ foo-validator.json
/containers:
clients.json
containers.json
+cookbook_artifacts.json
cookbooks.json
data.json
environments.json
groups.json
nodes.json
+policies.json
roles.json
sandboxes.json
diff --git a/spec/integration/knife/upload_spec.rb b/spec/integration/knife/upload_spec.rb
index 826ecec364..6ca8c3d8ce 100644
--- a/spec/integration/knife/upload_spec.rb
+++ b/spec/integration/knife/upload_spec.rb
@@ -198,7 +198,7 @@ Created /nodes/y.json
Created /roles/y.json
Created /users/y.json
EOM
- knife('diff --name-status /').should_succeed ''
+ knife('diff /').should_succeed ''
end
it 'knife upload --no-diff adds the new files' do