Skip to content
This repository has been archived by the owner on Apr 7, 2018. It is now read-only.

Commit

Permalink
Reorder resources and provide resource instances when adding subscrip…
Browse files Browse the repository at this point in the history
…tions/notifications (#38)
  • Loading branch information
chrisroberts committed Jan 28, 2014
1 parent f10b272 commit 909139f
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions recipes/installer.rb
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
include_recipe 'omnibus_updater'
remote_path = node[:omnibus_updater][:full_url].to_s

ruby_block 'Omnibus Chef install notifier' do
block{ true }
action :nothing
subscribes :create, "remote_file[omnibus_remote[#{File.basename(remote_path)}]]", :immediately
notifies :run, "execute[omnibus_install[#{File.basename(remote_path)}]]", :delayed
end

file '/tmp/nocheck' do
content 'conflict=nocheck\naction=nocheck'
only_if { node['os'] =~ /^solaris/ }
end

ruby_block 'omnibus chef killer' do
block do
raise 'New omnibus chef version installed. Killing Chef run!'
end
action :nothing
only_if do
node[:omnibus_updater][:kill_chef_on_upgrade]
end
end

execute "omnibus_install[#{File.basename(remote_path)}]" do
case File.extname(remote_path)
when '.deb'
Expand All @@ -28,19 +31,16 @@
end
action :nothing
if(node[:omnibus_updater][:restart_chef_service])
notifies :restart, "service[chef-client]", :immediately
notifies :restart, resources(:service => 'chef-client'), :immediately
end
notifies :create, 'ruby_block[omnibus chef killer]', :immediately
notifies :create, resources(:ruby_block => 'omnibus chef killer'), :immediately
end

ruby_block 'omnibus chef killer' do
block do
raise 'New omnibus chef version installed. Killing Chef run!'
end
ruby_block 'Omnibus Chef install notifier' do
block{ true }
action :nothing
only_if do
node[:omnibus_updater][:kill_chef_on_upgrade]
end
subscribes :create, resources(:remote_file => "omnibus_remote[#{File.basename(remote_path)}]"), :immediately
notifies :run, resources(:execute => "omnibus_install[#{File.basename(remote_path)}]"), :delayed
end

include_recipe 'omnibus_updater::old_package_cleaner'

0 comments on commit 909139f

Please sign in to comment.