From: Tom Hughes Date: Sun, 16 Oct 2016 17:56:32 +0000 (+0100) Subject: Use smartd as the service name on 16.04 X-Git-Url: https://git.openstreetmap.org/chef.git/commitdiff_plain/90abd2ae601f41b566b633c0f619c34e8e4677be?hp=fd31d0bd32886ca4075d4938e374c5c7d72c9b8c;ds=sidebyside Use smartd as the service name on 16.04 --- diff --git a/cookbooks/hardware/recipes/default.rb b/cookbooks/hardware/recipes/default.rb index 13e24b80d..657395cf1 100644 --- a/cookbooks/hardware/recipes/default.rb +++ b/cookbooks/hardware/recipes/default.rb @@ -351,6 +351,12 @@ disks = disks.map do |disk| ] end +smartd_service = if node[:lsb][:release].to_f >= 16.04 + "smartd" + else + "smartmontools" + end + disks = disks.compact if disks.count > 0 @@ -369,7 +375,6 @@ if disks.count > 0 group "root" mode 0o644 variables :disks => disks - notifies :reload, "service[smartmontools]" end template "/etc/default/smartmontools" do @@ -377,12 +382,12 @@ if disks.count > 0 owner "root" group "root" mode 0o644 - notifies :restart, "service[smartmontools]" end - service "smartmontools" do + service smartd_service do action [:enable, :start] - supports :status => true, :restart => true, :reload => true + subscribes :reload, "template[/etc/smartd.conf]" + subscribes :restart, "template[/etc/default/smartmontools]" end # Don't try and do munin monitoring of disks behind @@ -399,7 +404,7 @@ if disks.count > 0 end end else - service "smartmontools" do + service smartd_service do action [:stop, :disable] end end