Commit 38058d5e authored by Tim Smith's avatar Tim Smith
Browse files

Fix converges

parent c696b7d2
module RsyslogCookbook
# helpers for the various service providers on Ubuntu systems
module Helpers
# use the correct provider based on the Ubuntu release
def find_provider
if Chef::VersionConstraint.new('>= 15.04').include?(node['platform_version'])
service_provider = Chef::Provider::Service::Systemd
......@@ -11,5 +12,16 @@ module RsyslogCookbook
end
service_provider
end
# declare the service with the appropriate provider if on Ubuntu
def declare_rsyslog_service
service_provider = 'ubuntu' == node['platform'] ? find_provider : nil
service node['rsyslog']['service_name'] do
supports restart: true, status: true
action [:enable, :start]
provider service_provider
end
end
end
end
......@@ -29,13 +29,7 @@ property :source, kind_of: String, default: 'file-input.conf.erb'
include RsyslogCookbook::Helpers
action :create do
service_provider = 'ubuntu' == node['platform'] ? find_provider : nil
service node['rsyslog']['service_name'] do
supports restart: true, status: true
action [:enable, :start]
provider service_provider
end
declare_rsyslog_service
template "/etc/rsyslog.d/#{new_resource.priority}-#{new_resource.name}.conf" do
mode '0664'
......
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