Commit c5d19ad5 authored by Tim Smith's avatar Tim Smith
Browse files

Merge pull request #43 from slbmeh/master

added test for search ability to utlize search on solo if available
parents f8eab689 bd9c44c0
......@@ -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] && !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 do |server|
......
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