Commit 99e3a657 authored by Andrew Crump's avatar Andrew Crump

FC003: Check before using server-specific features

parent 237cbb89
......@@ -22,9 +22,12 @@ ossec_server = Array.new
if node.run_list.roles.include?(node['ossec']['server_role'])
ossec_server << node['ipaddress']
else
if Chef::Config[:solo]
Chef::Log.warn("This recipe uses search. Chef Solo does not support search.")
search(:node,"role:#{node['ossec']['server_role']}") do |n|
ossec_server << n['ipaddress']
end
end
end
node.set['ossec']['user']['install_type'] = "agent"
......
......@@ -28,7 +28,10 @@ agent_manager = "#{node['ossec']['user']['dir']}/bin/ossec-batch-manager.pl"
ssh_hosts = Array.new
search(:node, "ossec:[* TO *] NOT role:#{node['ossec']['server_role']}") do |n|
if Chef::Config[:solo]
Chef::Log.warn("This recipe uses search. Chef Solo does not support search.")
else
search(:node, "ossec:[* TO *] NOT role:#{node['ossec']['server_role']}") do |n|
ssh_hosts << n['ipaddress'] if n['keys']
......@@ -36,6 +39,7 @@ search(:node, "ossec:[* TO *] NOT role:#{node['ossec']['server_role']}") do |n|
not_if "grep '#{n['hostname']} #{n['ipaddress']}' #{node['ossec']['user']['dir']}/etc/client.keys"
end
end
end
template "/usr/local/bin/dist-ossec-keys.sh" do
......
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