not_if not being respected in execute resource?

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

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, kallen@groknaut.net 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: adam@opscode.com

On Mon, 25 Jun 2012, Adam Jacob wrote:

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

::blinkblink:: .. there it is! thanks for the eyeballs. tis fixed now.
"/usr/java" != "#{java_home}".

On Mon, Jun 25, 2012 at 12:34 PM, kallen@groknaut.net 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: adam@opscode.com

My pleasure! If only every issue were so easy :slight_smile:

Adam

On Mon, Jun 25, 2012 at 1:16 PM, kallen@groknaut.net wrote:

On Mon, 25 Jun 2012, Adam Jacob wrote:

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

::blinkblink:: .. there it is! thanks for the eyeballs. tis fixed now.
"/usr/java" != "#{java_home}".

On Mon, Jun 25, 2012 at 12:34 PM, kallen@groknaut.net 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: adam@opscode.com

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