[chef] not_if not being respected in execute resource?


Chronological Thread 
  • From:
  • To: chef < >
  • Subject: [chef] not_if not being respected in execute resource?
  • Date: Mon, 25 Jun 2012 12:34:05 -0700


or maybe i'm doing something silly and don't see it yet..

i have a recipe that downloads and unpacks a tarball. my intention for
this is to have it download only if the target directory does not
exist on the node. but what's happening is, the tarball gets downloaded
on each run.

am i using "not_if" correctly below? any suggestions?

thanks!
kallen


if File.directory?("/usr/java/jdk#{java_version}.hoight.#{m_arch}")
  # after the first run, the above line is true
  Chef::Log.debug("HIGGS-BOSON: dir exists: 
/usr/java/jdk#{java_version}.hoight.#{m_arch}")
end

execute "install_jdk_tarball" do
  user "root"
  cwd "/usr/java"
  command "curl -s 
http://#{depot}/depot/jdk#{java_version}.hoight.#{m_arch}.tgz ;| tar zxf -"
  not_if {File.directory?("#{java_home}/jdk#{java_version}.hoight.#{m_arch}")}
end




Archive powered by MHonArc 2.6.16.

§