silence warnings during rspec test runs

If we're testing via rspec, we don't need to include any corosync
recipes, so we don't need to warn about anything.

However if we're *not* testing and we're still using Chef Solo, then
pacemaker::default can't possibly work, due to corosync::authkey
requiring Chef search.  In this case we need to abort.
This commit is contained in:
Adam Spiers 2014-03-06 23:29:21 +00:00
parent 391eff06be
commit 1f3542d5a0
2 changed files with 8 additions and 1 deletions

View File

@ -39,7 +39,12 @@ if node[:pacemaker][:setup_hb_gui]
end
if Chef::Config[:solo]
::Chef::Log.warn "Using Chef Solo, you are expected to manually include the corosync default recipe!"
unless ENV['RSPEC_RUNNING']
Chef::Application.fatal! \
"pacemaker::default needs corosync::default which uses search, " \
"but Chef Solo does not support search."
return
end
else
include_recipe "corosync::default"
end

View File

@ -1,5 +1,7 @@
require 'chefspec'
ENV['RSPEC_RUNNING'] = 'true'
RSpec.configure do |config|
# config.mock_with :rspec do |mocks|
# # This option should be set when all dependencies are being loaded