]> git.openstreetmap.org Git - chef.git/commitdiff
Use smartd as the service name on 16.04
authorTom Hughes <tom@compton.nu>
Sun, 16 Oct 2016 17:56:32 +0000 (18:56 +0100)
committerTom Hughes <tom@compton.nu>
Sun, 16 Oct 2016 17:58:53 +0000 (18:58 +0100)
cookbooks/hardware/recipes/default.rb

index 13e24b80db2b1db4909b55accde37bebf7a50e44..657395cf1b831dd29b73d0b57e43846556947a69 100644 (file)
@@ -351,6 +351,12 @@ disks = disks.map do |disk|
   ]
 end
 
   ]
 end
 
+smartd_service = if node[:lsb][:release].to_f >= 16.04
+                   "smartd"
+                 else
+                   "smartmontools"
+                 end
+
 disks = disks.compact
 
 if disks.count > 0
 disks = disks.compact
 
 if disks.count > 0
@@ -369,7 +375,6 @@ if disks.count > 0
     group "root"
     mode 0o644
     variables :disks => disks
     group "root"
     mode 0o644
     variables :disks => disks
-    notifies :reload, "service[smartmontools]"
   end
 
   template "/etc/default/smartmontools" do
   end
 
   template "/etc/default/smartmontools" do
@@ -377,12 +382,12 @@ if disks.count > 0
     owner "root"
     group "root"
     mode 0o644
     owner "root"
     group "root"
     mode 0o644
-    notifies :restart, "service[smartmontools]"
   end
 
   end
 
-  service "smartmontools" do
+  service smartd_service do
     action [:enable, :start]
     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
   end
 
   # Don't try and do munin monitoring of disks behind
@@ -399,7 +404,7 @@ if disks.count > 0
     end
   end
 else
     end
   end
 else
-  service "smartmontools" do
+  service smartd_service do
     action [:stop, :disable]
   end
 end
     action [:stop, :disable]
   end
 end