summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortyler-ball <tball@chef.io>2019-04-23 10:29:33 -0600
committerMark Anderson <mark@chef.io>2019-05-03 21:28:03 -0700
commit30eb283aa687d259a6131c261fc5674d2eb41c8a (patch)
tree50f3a0782c54e0a5d85767b8b9aea72eae7f0e53
parentb134493e65d73636d25aa569f9b77f9c0b4c3f88 (diff)
downloadchef-30eb283aa687d259a6131c261fc5674d2eb41c8a.tar.gz
Read license-acceptance from chef config (knife.rb, client.rb)
Signed-off-by: tyler-ball <tball@chef.io>
-rw-r--r--lib/chef/application.rb7
-rw-r--r--spec/integration/client/client_spec.rb18
2 files changed, 6 insertions, 19 deletions
diff --git a/lib/chef/application.rb b/lib/chef/application.rb
index d5b0847f11..2970921d1e 100644
--- a/lib/chef/application.rb
+++ b/lib/chef/application.rb
@@ -251,7 +251,12 @@ class Chef
end
def check_license_acceptance
- LicenseAcceptance::Acceptor.check_and_persist!("chef-client", Chef::VERSION.to_s, logger: logger)
+ LicenseAcceptance::Acceptor.check_and_persist!(
+ "infra-client",
+ Chef::VERSION.to_s,
+ logger: logger,
+ provided: Chef::Config[:chef_license]
+ )
end
# Actually run the application
diff --git a/spec/integration/client/client_spec.rb b/spec/integration/client/client_spec.rb
index 23f262ad02..cde25662c1 100644
--- a/spec/integration/client/client_spec.rb
+++ b/spec/integration/client/client_spec.rb
@@ -60,24 +60,6 @@ describe "chef-client" do
shell_out!("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default'", cwd: chef_dir)
end
- it "should complete successfully with no other environment variables", skip: (Chef::Platform.windows?) do
- file "config/client.rb", <<~EOM
- local_mode true
- cookbook_path "#{path_to('cookbooks')}"
- # One environment variable we DO need to prevent hanging
- ENV["CHEF_LICENSE"] = "accept-no-persist"
- EOM
-
- begin
- result = shell_out("env -i #{critical_env_vars} #{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default'", cwd: chef_dir)
- result.error!
- rescue
- Chef::Log.info "Bare invocation will have the following load-path."
- Chef::Log.info shell_out!("env -i #{critical_env_vars} ruby -e 'puts $:'").stdout
- raise
- end
- end
-
it "should complete successfully with --no-listen" do
file "config/client.rb", <<~EOM
local_mode true