[chef] Using not_if in bash block still causes file to be downloaded


Chronological Thread 
  • From: Arthur Kalmenson < >
  • To:
  • Subject: [chef] Using not_if in bash block still causes file to be downloaded
  • Date: Fri, 3 Feb 2012 10:43:32 -0500

Hello everyone,

I'm writing a recipe to install hubot using the bash resource and using the not_if constraint to avoid reinstalling each time chef-client runs. While the reinstall does not happen, I'm finding that the hubot file continues to be downloaded with wget. Therefore, the /tmp dir is filling up with hubot tar files. Is there a reason why parts of the bash block execute and others don't?

The recipe looks as follows:

...

install_dir = "#{node['hubot']['install_dir']}"
install_dir_parent = "#{node['hubot']['install_dir_parent']}"
version = "#{node['hubot']['version']}"

...

bash "install hubot" do
  user hubot_user
  group hubot_group
  environment ({'HOME' => "#{install_dir}" })
  cwd install_dir_parent
  code <<-EOH
    tar xzf /tmp/hubot-#{version}.tar.gz && \
    cd hubot && \
    npm install
  EOH
  not_if "#{install_dir}/bin/hubot -v 2>&1 | grep '#{version}'"
end

The full recipe file is here: https://gist.github.com/1730793. Thank you in advance for any help.

All the best,
--
Arthur Kalmenson



Archive powered by MHonArc 2.6.16.

§