summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordanielsdeleo <dan@getchef.com>2015-05-20 17:12:29 -0700
committerdanielsdeleo <dan@getchef.com>2015-05-20 17:12:29 -0700
commitb21bbe7915177d5a6672e56c2bb29104540085c4 (patch)
tree23e0eca35095bf51e0cb11d06c3b314d51037041
parenta151519eddd94303afc1f4cda4ca3f0ff0bee54b (diff)
downloadchef-policyfile-native-default.tar.gz
Make policyfile native mode the defaultpolicyfile-native-default
-rw-r--r--chef-config/lib/chef-config/config.rb23
-rw-r--r--spec/unit/policy_builder/policyfile_spec.rb6
2 files changed, 20 insertions, 9 deletions
diff --git a/chef-config/lib/chef-config/config.rb b/chef-config/lib/chef-config/config.rb
index 800e8065de..63de8a451f 100644
--- a/chef-config/lib/chef-config/config.rb
+++ b/chef-config/lib/chef-config/config.rb
@@ -339,16 +339,23 @@ module ChefConfig
# most of our testing scenarios)
default :minimal_ohai, false
- # Policyfile is an experimental feature where a node gets its run list and
- # cookbook version set from a single document on the server instead of
- # expanding the run list and having the server compute the cookbook version
- # set based on environment constraints.
- #
- # Because this feature is experimental, it is not recommended for
- # production use. Developent/release of this feature may not adhere to
- # semver guidelines.
+ # Policyfile is a feature where a node gets its run list and cookbook
+ # version set from a single document on the server instead of expanding the
+ # run list and having the server compute the cookbook version set based on
+ # environment constraints.
default :use_policyfile, false
+ # Policyfiles can be used in a native mode (default) or compatibility mode.
+ # Native mode requires Chef Server 12.1 (it can be enabled via feature flag
+ # on some prior versions). In native mode, policies and associated
+ # cookbooks are accessed via feature-specific APIs. In compat mode,
+ # policies are stored as data bags and cookbooks are stored at the
+ # cookbooks/ endpoint. Compatibility mode can be dangerous on existing Chef
+ # Servers; it's recommended to upgrade your Chef Server rather than use
+ # compatibility mode. Compatibility mode remains available so you can use
+ # policyfiles with servers that don't yet support the native endpoints.
+ default :policy_document_native_api, true
+
# Set these to enable SSL authentication / mutual-authentication
# with the server
diff --git a/spec/unit/policy_builder/policyfile_spec.rb b/spec/unit/policy_builder/policyfile_spec.rb
index ad7c83b03b..5fa00d8f2b 100644
--- a/spec/unit/policy_builder/policyfile_spec.rb
+++ b/spec/unit/policy_builder/policyfile_spec.rb
@@ -166,13 +166,17 @@ describe Chef::PolicyBuilder::Policyfile do
end
before do
- # TODO: agree on this name and logic.
+ Chef::Config[:policy_document_native_api] = false
Chef::Config[:deployment_group] = "example-policy-stage"
allow(policy_builder).to receive(:http_api).and_return(http_api)
end
describe "when using compatibility mode (policy_document_native_api == false)" do
+ before do
+ Chef::Config[:deployment_group] = "example-policy-stage"
+ end
+
context "when the deployment group cannot be loaded" do
let(:error404) { Net::HTTPServerException.new("404 message", :body) }