diff options
author | Lance Albertson <lance@osuosl.org> | 2020-06-06 21:45:01 -0700 |
---|---|---|
committer | Lance Albertson <lance@osuosl.org> | 2020-06-17 22:27:40 -0700 |
commit | 04546d592e05170c8756d0aa770acba8e0cbd598 (patch) | |
tree | 3842a5b5b19a1f4b5714340d78808959a94279ab | |
parent | e89b82b3028ea1d2b0591c20297f03ec2d818537 (diff) | |
download | chef-04546d592e05170c8756d0aa770acba8e0cbd598.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 6469e9b532..c858e02eda 100644 --- a/lib/chef/application/apply.rb +++ b/lib/chef/application/apply.rb @@ -216,7 +216,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 f5800e61a9..655c98bef6 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 |