diff options
author | danielsdeleo <dan@chef.io> | 2016-01-21 16:05:51 -0800 |
---|---|---|
committer | danielsdeleo <dan@chef.io> | 2016-01-26 18:12:46 -0800 |
commit | f766e4a564688a75aebc9070269259b5d8adc4a2 (patch) | |
tree | b34733674e77b4e1b98cd95864957a63e897959d /lib | |
parent | 241aa599727391df325d35e5764b1996082d1490 (diff) | |
download | chef-f766e4a564688a75aebc9070269259b5d8adc4a2.tar.gz |
Enable Chef 12 mode for local mode by default
Diffstat (limited to 'lib')
-rw-r--r-- | lib/chef/chef_fs/chef_fs_data_store.rb | 26 | ||||
-rw-r--r-- | lib/chef/local_mode.rb | 2 |
2 files changed, 26 insertions, 2 deletions
diff --git a/lib/chef/chef_fs/chef_fs_data_store.rb b/lib/chef/chef_fs/chef_fs_data_store.rb index 634faaec7e..59c2699cca 100644 --- a/lib/chef/chef_fs/chef_fs_data_store.rb +++ b/lib/chef/chef_fs/chef_fs_data_store.rb @@ -126,6 +126,24 @@ class Chef # - `delete(association_requests/NAME)` -> `get(/invitations.json)`, remove name, `set(/invitations.json)` # class ChefFSDataStore + + # The base directories in a Chef Repo; even when these don't exist, a + # matching GET for these objects will return an empty list instead of a + # 404. + BASE_DIRNAMES = %w{ + clients + cookbooks + data + environments + nodes + roles + users + containers + groups + policy_groups + policies + }.freeze + # # Create a new ChefFSDataStore # @@ -469,7 +487,11 @@ class Chef # LIST /policies elsif path == [ "policies" ] with_entry([ path[0] ]) do |policies| - policies.children.map { |policy| policy.name[0..-6].rpartition("-")[0] }.uniq + begin + policies.children.map { |policy| policy.name[0..-6].rpartition("-")[0] }.uniq + rescue Chef::ChefFS::FileSystem::NotFoundError + [] + end end # LIST /policies/POLICY/revisions @@ -741,7 +763,7 @@ class Chef end def path_always_exists?(path) - return path.length == 1 && %w{clients cookbooks data environments nodes roles users}.include?(path[0]) + return path.length == 1 && BASE_DIRNAMES.include?(path[0]) end def with_entry(path) diff --git a/lib/chef/local_mode.rb b/lib/chef/local_mode.rb index 53234ec7d5..82d9cdee32 100644 --- a/lib/chef/local_mode.rb +++ b/lib/chef/local_mode.rb @@ -65,6 +65,8 @@ class Chef server_options = {} server_options[:data_store] = data_store server_options[:log_level] = Chef::Log.level + server_options[:osc_compat] = Chef::Config.chef_zero.osc_compat + server_options[:single_org] = Chef::Config.chef_zero.single_org server_options[:host] = Chef::Config.chef_zero.host server_options[:port] = parse_port(Chef::Config.chef_zero.port) |