Commit ec82dd0c authored by Matt Ray's avatar Matt Ray Committed by jtimberman
Browse files

replace raise with Chef::Log.fatal and the only_if was redundant with the file Resource

parent 1b16a1f3
......@@ -2,7 +2,7 @@
# Cookbook Name:: rsyslog
# Recipe:: client
#
# Copyright 2009-2011, Opscode, Inc.
# Copyright 2009-2013, Opscode, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
......@@ -23,10 +23,10 @@ if !node['rsyslog']['server'] and node['rsyslog']['server_ip'].nil? and Chef::Co
Chef::Log.fatal("Chef Solo does not support search, therefore it is a requirement of the rsyslog::client recipe that the attribute 'server_ip' is set when using Chef Solo. 'server_ip' is not set.")
elsif !node['rsyslog']['server']
rsyslog_server = node['rsyslog']['server_ip'] ||
search(:node, node['rsyslog']['server_search']).first['ipaddress'] rescue nil
search(:node, node['rsyslog']['server_search']).first['ipaddress'] rescue nil
if rsyslog_server.nil?
raise "The rsyslog::client recipe was unable to determine the remote syslog server. Checked both the server_ip attribute and search()"
Chef::Log.fatal("The rsyslog::client recipe was unable to determine the remote syslog server. Checked both the server_ip attribute and search()")
end
template "/etc/rsyslog.d/49-remote.conf" do
......@@ -36,7 +36,7 @@ elsif !node['rsyslog']['server']
variables(
:server => rsyslog_server,
:protocol => node['rsyslog']['protocol']
)
)
owner node["rsyslog"]["user"]
group node["rsyslog"]["group"]
mode 0644
......@@ -44,7 +44,6 @@ elsif !node['rsyslog']['server']
end
file "/etc/rsyslog.d/server.conf" do
only_if do ::File.exists?("/etc/rsyslog.d/server.conf") end
action :delete
notifies :reload, "service[#{node['rsyslog']['service_name']}]"
end
......
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