[chef] Re: Chef Notify Before?


Chronological Thread 
  • From: Peter Donald < >
  • To:
  • Subject: [chef] Re: Chef Notify Before?
  • Date: Thu, 14 Mar 2013 09:46:38 +1100

Hi,

Under linux I have been using not ifs with procs so that I don't
download/unpack/install package if they are already isntalled.
SOmething similar to the following. HTH.

package_url = node['foo']['package_url']
base_package_filename = File.basename(package_url)
cached_package_filename =
"#{Chef::Config[:file_cache_path]}/#{base_package_filename}"
check_proc = Proc.new { ::File.exists?( node['foo']['base_dir'] ) }

remote_file cached_package_filename do
  not_if { check_proc.call }
  source package_url
  mode '0600'
  action :create_if_missing
end

package 'unzip'

bash 'unpack_foo' do
  not_if { check_proc.call }
  code <<-EOF
...
EOF
end

bash 'install_foo' do
  not_if { check_proc.call }
  code <<-EOF
...
test -d #{node['foo']['base_dir']}
EOF
end



-- 
Cheers,

Peter Donald



Archive powered by MHonArc 2.6.16.

§