summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authordanielsdeleo <dan@chef.io>2015-09-23 12:50:54 -0700
committerdanielsdeleo <dan@chef.io>2015-09-24 12:37:26 -0700
commit14d7baab6365e0b4146990a5306f80a7f0d09a82 (patch)
tree70292b704f85ab6c06b6b52f3a0d89e418c954f1 /spec
parent4141c33df8e31b78359fb316315547d36f837df6 (diff)
downloadchef-14d7baab6365e0b4146990a5306f80a7f0d09a82.tar.gz
Don't pass -E to chef-client unless given an environment
Chef::PolicyBuilder::Policyfile requires `Chef::Config[:environment]` to be nil or empty, in order to prevent confusion that could arise from using two conflicting features. Because `chef-client` merges CLI options to `Chef::Config` automatically, running `chef-cient -E _default` causes `Chef::Config[:environment]` to be non-nil, resulting in chef-client emitting this error when bootstrapping: ``` 192.168.99.143 Unexpected Error: 192.168.99.143 ----------------- 192.168.99.143 Chef::PolicyBuilder::Policyfile::UnsupportedFeature: Policyfile does not work with Chef Environments ``` For non-policyfile users, this should behave the same as before since Chef will just default to the `_default` environment (this gets set via Node#initialize) if none is specified.
Diffstat (limited to 'spec')
-rw-r--r--spec/unit/knife/core/bootstrap_context_spec.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/spec/unit/knife/core/bootstrap_context_spec.rb b/spec/unit/knife/core/bootstrap_context_spec.rb
index a93e5362a9..0433ef9983 100644
--- a/spec/unit/knife/core/bootstrap_context_spec.rb
+++ b/spec/unit/knife/core/bootstrap_context_spec.rb
@@ -38,14 +38,14 @@ describe Chef::Knife::Core::BootstrapContext do
expect{described_class.new(config, run_list, chef_config)}.not_to raise_error
end
- it "runs chef with the first-boot.json in the _default environment" do
- expect(bootstrap_context.start_chef).to eq "chef-client -j /etc/chef/first-boot.json -E _default"
+ it "runs chef with the first-boot.json with no environment specified" do
+ expect(bootstrap_context.start_chef).to eq "chef-client -j /etc/chef/first-boot.json"
end
describe "when in verbosity mode" do
let(:config) { {:verbosity => 2} }
it "adds '-l debug' when verbosity is >= 2" do
- expect(bootstrap_context.start_chef).to eq "chef-client -j /etc/chef/first-boot.json -l debug -E _default"
+ expect(bootstrap_context.start_chef).to eq "chef-client -j /etc/chef/first-boot.json -l debug"
end
end
@@ -70,7 +70,7 @@ EXPECTED
describe "alternate chef-client path" do
let(:chef_config){ {:chef_client_path => '/usr/local/bin/chef-client'} }
it "runs chef-client from another path when specified" do
- expect(bootstrap_context.start_chef).to eq "/usr/local/bin/chef-client -j /etc/chef/first-boot.json -E _default"
+ expect(bootstrap_context.start_chef).to eq "/usr/local/bin/chef-client -j /etc/chef/first-boot.json"
end
end