[chef] Re: not_if not being respected in execute resource?


Chronological Thread 
  • From: Adam Jacob < >
  • To:
  • Subject: [chef] Re: not_if not being respected in execute resource?
  • Date: Mon, 25 Jun 2012 13:04:55 -0700

The obvious question: does java_home exist? Your print statement and
the not_if are not identical...

Adam

On Mon, Jun 25, 2012 at 12:34 PM,  
< >
 wrote:
>
> 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
>



-- 
Opscode, Inc.
Adam Jacob, Chief Customer Officer
T: (206) 619-7151 E: 




Archive powered by MHonArc 2.6.16.

§