summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Dibowitz <phil@ipom.com>2017-10-04 18:26:59 -0700
committerGitHub <noreply@github.com>2017-10-04 18:26:59 -0700
commit6ecae1eba56f77f38c26c2114bb89f9d4f80b167 (patch)
treebb7b7890e3f163f2612c39216bbf39fd89aa4876
parent8c7ade8da4256e2ebec7a800cdc6aa3526fde0d5 (diff)
downloadohai-6ecae1eba56f77f38c26c2114bb89f9d4f80b167.tar.gz
Fix 8-stable build (#1067)
PR #1065 broke the 8-stable build... though Travis claimed it passed. There is no @cli mode in 8.x, so of course that code behaves differently. Cleaning up to fix tests. Also, chefstyle Signed-off-by: Phil Dibowitz <phil@ipom.com>
-rw-r--r--lib/ohai/system.rb9
-rw-r--r--spec/unit/system_spec.rb5
2 files changed, 4 insertions, 10 deletions
diff --git a/lib/ohai/system.rb b/lib/ohai/system.rb
index b63e1df7..96175190 100644
--- a/lib/ohai/system.rb
+++ b/lib/ohai/system.rb
@@ -105,13 +105,8 @@ module Ohai
end
critical_failed = Ohai::Config.ohai[:critical_plugins] & @runner.failed_plugins
unless critical_failed.empty?
- msg = "The following Ohai plugins marked as critical failed: #{critical_failed}"
- if @cli
- Ohai::Log.error(msg)
- exit(true)
- else
- fail Ohai::Exceptions::CriticalPluginFailure, "#{msg}. Failing Chef run."
- end
+ msg = "The following Ohai plugins marked as critical failed: #{critical_failed}. Exiting."
+ raise Ohai::Exceptions::CriticalPluginFailure, msg
end
end
diff --git a/spec/unit/system_spec.rb b/spec/unit/system_spec.rb
index af429008..f402072f 100644
--- a/spec/unit/system_spec.rb
+++ b/spec/unit/system_spec.rb
@@ -340,7 +340,7 @@ Ohai.plugin(:Park) do
end
EOF
- with_plugin("fails.rb", <<EOF)
+ with_plugin("fails.rb", <<EOF)
Ohai.plugin(:Fails) do
provides 'fails'
collect_data(:default) do
@@ -392,8 +392,7 @@ EOF
it "should fail when critical plugins fail" do
Ohai.config[:plugin_path] = [ path_to(".") ]
- expect(Ohai::Log).to receive(:error).with(/marked as critical/)
- ohai.all_plugins
+ expect { ohai.all_plugins }.to raise_error(Ohai::Exceptions::CriticalPluginFailure)
end
end