]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-cookbooks.git/commitdiff
Place service at the end of script to ensure that service is always enable and runnin...
authorGuilhem Lettron <guilhem@lettron.fr>
Tue, 9 Apr 2013 12:33:56 +0000 (14:33 +0200)
committerGuilhem Lettron <guilhem@lettron.fr>
Thu, 2 May 2013 09:09:00 +0000 (11:09 +0200)
recipes/mon.rb

index 6522ecc57f30b23a798b9820356c9a4efddd2f79..c49122d81304779603129606cec69565baec1009 100644 (file)
@@ -20,18 +20,6 @@ include_recipe "ceph::default"
 include_recipe "ceph::conf"
 
 service_type = node["ceph"]["mon"]["init_style"]
-service "ceph_mon" do
-  case service_type
-  when "upstart"
-    service_name "ceph-mon-all"
-    provider Chef::Provider::Service::Upstart
-    action :enable
-  when "sysvinit"
-    service_name "ceph"
-    provider Chef::Provider::Service::Init
-  end
-  supports :restart => true
-end
 
 directory "/var/run/ceph" do
   owner "root"
@@ -62,7 +50,6 @@ unless File.exists?("/var/lib/ceph/mon/ceph-#{node["hostname"]}/done")
 
   execute 'ceph-mon mkfs' do
     command "ceph-mon --mkfs -i #{node['hostname']} --keyring '#{keyring}'"
-    notifies :restart, "service[ceph_mon]", :immediately
   end
 
   ruby_block "finalise" do
@@ -74,6 +61,19 @@ unless File.exists?("/var/lib/ceph/mon/ceph-#{node["hostname"]}/done")
   end
 end
 
+service "ceph_mon" do
+  case service_type
+  when "upstart"
+    service_name "ceph-mon-all"
+    provider Chef::Provider::Service::Upstart
+  when "sysvinit"
+    service_name "ceph"
+    provider Chef::Provider::Service::Init
+  end
+  supports :restart => true
+  action [ :enable, :start ]
+end
+
 get_mon_addresses().each do |addr|
   execute "peer #{addr}" do
     command "ceph --admin-daemon '/var/run/ceph/ceph-mon.#{node['hostname']}.asok' add_bootstrap_peer_hint #{addr}"