From fb386990683b74ac5ac8a6d7c9ca5932d2589e87 Mon Sep 17 00:00:00 2001 From: Greg Barker Date: Fri, 16 Oct 2015 01:29:21 -0700 Subject: [PATCH] Fix #30 Add support for Ubuntu 15.04 and systemd --- providers/hostname.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/providers/hostname.rb b/providers/hostname.rb index a95dd60..5b23d31 100644 --- a/providers/hostname.rb +++ b/providers/hostname.rb @@ -209,7 +209,11 @@ class Recipe status: false, reload: true } - service_provider = ::Chef::Provider::Service::Upstart + 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 + end end service service_name do