Commit 661fccee authored by Steve Buzonas's avatar Steve Buzonas
Browse files

added test for search ability to utlize search on solo if available

parent bf10683a
......@@ -22,13 +22,20 @@ return if node['rsyslog']['server']
include_recipe 'rsyslog::default'
def chef_solo_search_installed?
klass = ::Search::const_get('Helper')
return klass.is_a?(Class)
rescue NameError
return false
end
# On Chef Solo, we use the node['rsyslog']['server_ip'] attribute, and on
# normal Chef, we leverage the search query.
if Chef::Config[:solo]
if Chef::Config[:solo] and not chef_solo_search_installed?
if node['rsyslog']['server_ip']
rsyslog_servers = Array(node['rsyslog']['server_ip'])
else
Chef::Application.fatal!("Chef Solo does not support search. You must set node['rsyslog']['server_ip']!")
Chef::Application.fatal!("Chef Solo does not support search. You must set node['rsyslog']['server_ip'] or use the chef-solo-search cookbook!")
end
else
results = search(:node, node['rsyslog']['server_search']).map { |n| n['ipaddress'] }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment