[chef] Re: Re: Chef Notify Before?


Chronological Thread 
  • From: Ranjib Dey < >
  • To:
  • Subject: [chef] Re: Re: Chef Notify Before?
  • Date: Wed, 13 Mar 2013 17:27:24 -0700

this looks fine,
you can change the remote_file resource guard should be not_if {::File.exists?(cached_package_name)}.

this should work.


On Wed, Mar 13, 2013 at 3:46 PM, Peter Donald < " target="_blank"> > wrote:
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.

§