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

Merge pull request #89 from fjg/fix-ubuntu-service-provider

fix(provider): since Ubuntu 15.04 should use Systemd
parents 0595dc43 d0584032
module RsyslogCookbook
# helpers for the various service providers on Ubuntu systems
module Helpers
def declare_rsyslog_service
if node['platform'] == 'ubuntu' && node['platform_version'].to_f >= 12.04
service_provider = Chef::Provider::Service::Upstart
else
service_provider = nil
end
service node['rsyslog']['service_name'] do
supports :restart => true, :status => true
action [:enable, :start]
provider service_provider
end
end
end
module RsyslogCookbook
# helpers for the various service providers on Ubuntu systems
module Helpers
def declare_rsyslog_service
if 'ubuntu' == node['platform']
if Chef::VersionConstraint.new('>= 15.04').include?(node['platform_version'])
service_provider = Chef::Provider::Service::Systemd
elsif Chef::VersionConstraint.new('>= 12.04').include?(node['platform_version'])
service_provider = Chef::Provider::Service::Upstart
else
service_provider = nil
end
end
service 'rsyslog' do
service_name node['rsyslog']['service_name']
supports :restart => true, :status => true
action [:enable, :start]
provider service_provider
end
end
end
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