diff options
author | Tim Smith <tsmith@chef.io> | 2019-04-29 16:04:06 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-29 16:04:06 -0700 |
commit | 338eb3a5d24689fa0983634560089d38160b91d3 (patch) | |
tree | 87d904eb18cfb4c899dfde4e5976077a6febb479 /spec | |
parent | e21a548417d271a8dbe085fc6498c3bcb2022e7d (diff) | |
parent | b95649acc976ea33bd46fdd073869d70fb689684 (diff) | |
download | chef-338eb3a5d24689fa0983634560089d38160b91d3.tar.gz |
Merge pull request #8411 from chef/mp/license-acceptance-in-bootstrap
Enable license acceptance during bootstrap
Diffstat (limited to 'spec')
-rw-r--r-- | spec/unit/knife/core/bootstrap_context_spec.rb | 12 | ||||
-rw-r--r-- | spec/unit/knife/core/windows_bootstrap_context_spec.rb | 8 |
2 files changed, 14 insertions, 6 deletions
diff --git a/spec/unit/knife/core/bootstrap_context_spec.rb b/spec/unit/knife/core/bootstrap_context_spec.rb index 7b12177ab9..2ed8b6bc51 100644 --- a/spec/unit/knife/core/bootstrap_context_spec.rb +++ b/spec/unit/knife/core/bootstrap_context_spec.rb @@ -46,21 +46,21 @@ 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 with no environment specified" do - expect(bootstrap_context.start_chef).to eq "chef-client -j /etc/chef/first-boot.json" + it "runs chef with the first-boot.json with no environment other than chef-license acceptance specified" do + expect(bootstrap_context.start_chef).to eq "CHEF_LICENSE=accept chef-client -j /etc/chef/first-boot.json" end describe "when in verbosity mode" do let(:config) { { verbosity: 2, color: true } } 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" + expect(bootstrap_context.start_chef).to eq "CHEF_LICENSE=accept chef-client -j /etc/chef/first-boot.json -l debug" end end describe "when no color value has been set in config" do let(:config) { { color: false } } it "adds '--no-color' when color is false" do - expect(bootstrap_context.start_chef).to eq "chef-client -j /etc/chef/first-boot.json --no-color" + expect(bootstrap_context.start_chef).to eq "CHEF_LICENSE=accept chef-client -j /etc/chef/first-boot.json --no-color" end end @@ -82,7 +82,7 @@ describe Chef::Knife::Core::BootstrapContext do 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" + expect(bootstrap_context.start_chef).to eq "CHEF_LICENSE=accept /usr/local/bin/chef-client -j /etc/chef/first-boot.json" end end @@ -105,7 +105,7 @@ describe Chef::Knife::Core::BootstrapContext do describe "when bootstrapping into a specific environment" do let(:config) { { environment: "prodtastic", color: true } } it "starts chef in the configured environment" do - expect(bootstrap_context.start_chef).to eq("chef-client -j /etc/chef/first-boot.json -E prodtastic") + expect(bootstrap_context.start_chef).to eq("CHEF_LICENSE=accept chef-client -j /etc/chef/first-boot.json -E prodtastic") end end diff --git a/spec/unit/knife/core/windows_bootstrap_context_spec.rb b/spec/unit/knife/core/windows_bootstrap_context_spec.rb index 3ab173f316..a19ad11247 100644 --- a/spec/unit/knife/core/windows_bootstrap_context_spec.rb +++ b/spec/unit/knife/core/windows_bootstrap_context_spec.rb @@ -264,4 +264,12 @@ describe Chef::Knife::Core::WindowsBootstrapContext do end end end + + describe "#start_chef" do + it "the command includes the license acceptance environment variable" do + expect(bootstrap_context.start_chef).to match(/SET "CHEF_LICENSE=accept"\n/m) + end + + end + end |