diff options
-rw-r--r-- | MAINTAINERS.md | 6 | ||||
-rw-r--r-- | MAINTAINERS.toml | 8 | ||||
-rw-r--r-- | lib/chef/client.rb | 18 | ||||
-rw-r--r-- | spec/unit/client_spec.rb | 54 |
4 files changed, 61 insertions, 25 deletions
diff --git a/MAINTAINERS.md b/MAINTAINERS.md index d645dd7353..e397a990fa 100644 --- a/MAINTAINERS.md +++ b/MAINTAINERS.md @@ -133,3 +133,9 @@ The specific components of Chef related to a given platform - including (but not * [Cory Stephenson](https://github.com/Aevin1387) * [David Aronsohn](https://github.com/tbunnyman) +## OpenBSD + +### Lieutenant + +* [Joe Miller](https://github.com/joemiller) + diff --git a/MAINTAINERS.toml b/MAINTAINERS.toml index b0257c7fa3..68615337a6 100644 --- a/MAINTAINERS.toml +++ b/MAINTAINERS.toml @@ -145,6 +145,10 @@ The specific components of Chef related to a given platform - including (but not "tBunnyMan" ] + [Org.Components.Subsystems.OpenBSD] + title = "OpenBSD" + + lieutenant = "joemiller" [people] [people.adamhjk] @@ -230,3 +234,7 @@ The specific components of Chef related to a given platform - including (but not [people.ksubrama] Name = "Kartik Cating-Subramanian" GitHub = "ksubrama" + + [people.joemiller] + Name = "Joe Miller" + GitHub = "joemiller" diff --git a/lib/chef/client.rb b/lib/chef/client.rb index 86e92585e3..3c86f52b4a 100644 --- a/lib/chef/client.rb +++ b/lib/chef/client.rb @@ -309,12 +309,18 @@ class Chef # with the proper exit status code and everything gets raised # as a RunFailedWrappingError if run_error || converge_error || audit_error - error = if run_error == converge_error - Chef::Exceptions::RunFailedWrappingError.new(converge_error, audit_error) - else - Chef::Exceptions::RunFailedWrappingError.new(run_error, converge_error, audit_error) - end - error.fill_backtrace + error = if Chef::Config[:audit_mode] == :disabled + run_error || converge_error + else + e = if run_error == converge_error + Chef::Exceptions::RunFailedWrappingError.new(converge_error, audit_error) + else + Chef::Exceptions::RunFailedWrappingError.new(run_error, converge_error, audit_error) + end + e.fill_backtrace + e + end + Chef::Application.debug_stacktrace(error) raise error end diff --git a/spec/unit/client_spec.rb b/spec/unit/client_spec.rb index 1e4bbb5c56..8146774764 100644 --- a/spec/unit/client_spec.rb +++ b/spec/unit/client_spec.rb @@ -238,23 +238,24 @@ describe Chef::Client do describe "when converge completes successfully" do include_context "a client run" include_context "converge completed" - - describe "when audit phase errors" do - include_context "audit phase failed with error" - include_examples "a completed run with audit failure" do - let(:run_errors) { [audit_error] } + context 'when audit mode is enabled' do + describe "when audit phase errors" do + include_context "audit phase failed with error" + include_examples "a completed run with audit failure" do + let(:run_errors) { [audit_error] } + end end - end - describe "when audit phase completed" do - include_context "audit phase completed" - include_examples "a completed run" - end + describe "when audit phase completed" do + include_context "audit phase completed" + include_examples "a completed run" + end - describe "when audit phase completed with failed controls" do - include_context "audit phase completed with failed controls" - include_examples "a completed run with audit failure" do - let(:run_errors) { [audit_error] } + describe "when audit phase completed with failed controls" do + include_context "audit phase completed with failed controls" + include_examples "a completed run with audit failure" do + let(:run_errors) { [audit_error] } + end end end end @@ -512,11 +513,26 @@ describe Chef::Client do allow_any_instance_of(Chef::RunLock).to receive(:save_pid).and_raise(NoMethodError) end - it "should run exception handlers on early fail" do - expect(subject).to receive(:run_failed) - expect { subject.run }.to raise_error(Chef::Exceptions::RunFailedWrappingError) do |error| - expect(error.wrapped_errors.size).to eq 1 - expect(error.wrapped_errors).to include(NoMethodError) + context 'when audit mode is enabled' do + before do + Chef::Config[:audit_mode] = :enabled + end + it "should run exception handlers on early fail" do + expect(subject).to receive(:run_failed) + expect { subject.run }.to raise_error(Chef::Exceptions::RunFailedWrappingError) do |error| + expect(error.wrapped_errors.size).to eq 1 + expect(error.wrapped_errors).to include(NoMethodError) + end + end + end + + context 'when audit mode is disabled' do + before do + Chef::Config[:audit_mode] = :disabled + end + it "should run exception handlers on early fail" do + expect(subject).to receive(:run_failed) + expect { subject.run }.to raise_error(NoMethodError) end end end |