Open bish0polis opened 5 years ago
Oh wow! It's a patch!!
Indentation around the template wasn't changed, specifically so the minimal change would be clear. Feel free to re-indent for sanity.
--- a/recipes/client.rb
+++ b/recipes/client.rb
@@ -49,7 +49,9 @@ end
if rsyslog_servers.empty?
Chef::Log.warn('The rsyslog::client recipe was unable to determine the remote syslog server. Checked both the server_ip attribute\
and search! Not forwarding logs.')
-else
+end
+
+# create or delete config as appropriate
remote_type = node['rsyslog']['use_relp'] ? 'relp' : 'remote'
template "#{node['rsyslog']['config_prefix']}/rsyslog.d/49-remote.conf" do
source "49-#{remote_type}.conf.erb"
@@ -60,6 +62,7 @@ else
notifies :run, 'execute[validate_config]'
notifies :restart, "service[#{node['rsyslog']['service_name']}]"
only_if { node['rsyslog']['remote_logs'] }
+ action rsyslog_servers.empty? ? :delete : :create
end
file "#{node['rsyslog']['config_prefix']}/rsyslog.d/server.conf" do
@@ -67,4 +70,3 @@ else
notifies :run, 'execute[validate_config]'
notifies :restart, "service[#{node['rsyslog']['service_name']}]"
end
-end
Marking stale due to inactivity. Remove stale label or comment or this will be closed in 7 days. Alternatively drop by the #sous-chefs channel on the Chef Community Slack and we'll be happy to help! Thanks, Sous-Chefs.
But there's a patch RIGHT THERE!
@bish0polis this cookbook was recently transferred to the Sous Chefs and this bot was part of the standardization process. Rest assured, we'll get to this soon once we get this properly adopted.
Cookbook version
6.0.8 + #152
Chef-client version
chef-14.10.9-1.el7.x86_64
Platform Details
centos-release-7-6.1810.2.el7.centos.x86_64
Scenario:
As rsyslog servers drop to 0 members in the list, the 49-remote.conf is not removed.
Steps to Reproduce:
Expected Result:
Remote.conf file should be removed to reflect empty forward-server list.
Actual Result:
Nothing: file is not changed nor removed.