From cb8ac7bb6ad8c6626b6a30ebed7f88d92da4b383 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ji=C5=99=C3=AD=20Suchomel?= Date: Thu, 25 Sep 2014 11:02:48 +0200 Subject: [PATCH] create 'done' file (and friends) for ubuntu only --- recipes/mon.rb | 60 +++++++++++++++++++++++++------------------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/recipes/mon.rb b/recipes/mon.rb index f69e679..d98c7b5 100644 --- a/recipes/mon.rb +++ b/recipes/mon.rb @@ -41,44 +41,44 @@ end # TODO: cluster name cluster = 'ceph' -unless File.exist?("/var/lib/ceph/mon/ceph-#{node['hostname']}/done") - keyring = "#{Chef::Config[:file_cache_path]}/#{cluster}-#{node['hostname']}.mon.keyring" +keyring = "#{Chef::Config[:file_cache_path]}/#{cluster}-#{node['hostname']}.mon.keyring" - execute 'format mon-secret as keyring' do - command lazy { "ceph-authtool '#{keyring}' --create-keyring --name=mon. --add-key='#{mon_secret}' --cap mon 'allow *'" } - creates "#{Chef::Config[:file_cache_path]}/#{cluster}-#{node['hostname']}.mon.keyring" - only_if { mon_secret } - end +execute 'format mon-secret as keyring' do + command lazy { "ceph-authtool '#{keyring}' --create-keyring --name=mon. --add-key='#{mon_secret}' --cap mon 'allow *'" } + creates "#{Chef::Config[:file_cache_path]}/#{cluster}-#{node['hostname']}.mon.keyring" + only_if { mon_secret } +end - execute 'generate mon-secret as keyring' do - command "ceph-authtool '#{keyring}' --create-keyring --name=mon. --gen-key --cap mon 'allow *'" - creates "#{Chef::Config[:file_cache_path]}/#{cluster}-#{node['hostname']}.mon.keyring" - not_if { mon_secret } - notifies :create, 'ruby_block[save mon_secret]', :immediately - end +execute 'generate mon-secret as keyring' do + command "ceph-authtool '#{keyring}' --create-keyring --name=mon. --gen-key --cap mon 'allow *'" + creates "#{Chef::Config[:file_cache_path]}/#{cluster}-#{node['hostname']}.mon.keyring" + not_if { mon_secret } + notifies :create, 'ruby_block[save mon_secret]', :immediately +end - ruby_block 'save mon_secret' do - block do - fetch = Mixlib::ShellOut.new("ceph-authtool '#{keyring}' --print-key --name=mon.") - fetch.run_command - key = fetch.stdout - node.set['ceph']['monitor-secret'] = key - node.save - end - action :nothing +ruby_block 'save mon_secret' do + block do + fetch = Mixlib::ShellOut.new("ceph-authtool '#{keyring}' --print-key --name=mon.") + fetch.run_command + key = fetch.stdout + node.set['ceph']['monitor-secret'] = key + node.save end + action :nothing +end - execute 'ceph-mon mkfs' do - command "ceph-mon --mkfs -i #{node['hostname']} --keyring '#{keyring}'" - end +execute 'ceph-mon mkfs' do + command "ceph-mon --mkfs -i #{node['hostname']} --keyring '#{keyring}'" +end - ruby_block 'finalise' do - block do - ['done', service_type].each do |ack| - ::File.open("/var/lib/ceph/mon/ceph-#{node['hostname']}/#{ack}", 'w').close - end +# needed only by https://github.com/ceph/ceph/blob/master/src/upstart/ceph-mon-all-starter.conf +ruby_block 'finalise' do + block do + ['done', service_type].each do |ack| + ::File.open("/var/lib/ceph/mon/ceph-#{node['hostname']}/#{ack}", 'w').close end end + only_if { node['platform'] == 'ubuntu' } end if service_type == 'upstart' -- 2.47.3