diff options
author | Lance Albertson <lance@osuosl.org> | 2020-06-06 21:45:01 -0700 |
---|---|---|
committer | Lance Albertson <lance@osuosl.org> | 2020-06-08 12:34:39 -0700 |
commit | b8166de42ec1a7841eff9a7e2d7e6b6724075d89 (patch) | |
tree | 255e6feb7e18b12fd550d8ee5528ec25442095e2 | |
parent | 090e973e565a49fa48cf58a0fb95e5bc56002ef3 (diff) | |
download | chef-b8166de42ec1a7841eff9a7e2d7e6b6724075d89.tar.gz |
Fix how enforce_license is set in run method for chef-apply
I recently discovered that when using
Chef::Application::Apply.new.run(enforce_license: false), chef-apply will still
run the license verification when I expected it to be disabled. It seems this
feature works if you install this as a gem, however if you build chef using
omnibus with this set, it refuses to work. I suspect this might be something
with appbundler.
I noticed that other binaries (i.e. solo) were using "run(enforce_license:
false)" instead of "run(enforce_license = false)" which chef-apply uses. If I
changed this to "run(enforce_license: false)", this worked as expected.
Signed-off-by: Lance Albertson <lance@osuosl.org>
-rw-r--r-- | lib/chef/application/apply.rb | 2 | ||||
-rw-r--r-- | spec/unit/application_spec.rb | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/lib/chef/application/apply.rb b/lib/chef/application/apply.rb index 33a8a97f5b..4ed2d2a1f2 100644 --- a/lib/chef/application/apply.rb +++ b/lib/chef/application/apply.rb @@ -233,7 +233,7 @@ class Chef::Application::Apply < Chef::Application end # Get this party started - def run(enforce_license = false) + def run(enforce_license: false) reconfigure check_license_acceptance if enforce_license run_application diff --git a/spec/unit/application_spec.rb b/spec/unit/application_spec.rb index ea784f1d55..031132f31d 100644 --- a/spec/unit/application_spec.rb +++ b/spec/unit/application_spec.rb @@ -94,6 +94,13 @@ describe Chef::Application do end end + describe "when enforce_license is set to false" do + it "should not check the license acceptance" do + expect(@app).to_not receive(:check_license_acceptance) + @app.run(enforce_license: false) + end + end + it "should run the actual application" do expect(@app).to receive(:run_application).and_return(true) @app.run |