- From: Daniel DeLeo <
>
- To:
- Subject: [chef] Re: Re: Re: Using not_if in bash block still causes file to be downloaded
- Date: Fri, 3 Feb 2012 15:46:44 -0800
On Friday, February 3, 2012 at 1:01 PM, Arthur Kalmenson wrote:
>
Thanks Matt, that worked perfectly.
>
>
--
>
Arthur Kalmenson
>
>
>
On Fri, Feb 3, 2012 at 11:11 AM, Matt Ray
>
<
>
>
(mailto:
)>
>
wrote:
>
> Perhaps using remote_file might be cleaner?
>
>
>
>
>
> On Fri, Feb 3, 2012 at 9:43 AM, Arthur Kalmenson
>
> <
>
>
>
> (mailto:
)>
>
> wrote:
>
> > 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:
>
> >
>
> > bash "install hubot" do
>
> > user hubot_user
>
> > group hubot_group
>
> > environment ({'HOME' => "#{install_dir}" })
>
> > cwd install_dir_parent
>
> > code <<-EOH
>
> > wget -P /tmp
>
> > https://github.com/downloads/github/hubot/hubot-#{version}.tar.gz && \
>
> > 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
>
>
>
Remote file is definitely the way to go for operations like this. But I'm
confused as to why the not_if didn't work. Is it possible that you had the
version in the install_dir? Also, the latest version of Chef allows multiple
not_if statements, so you could test that the hubot command exists and then
test that it's the correct version.
HTH,
Dan DeLeo
Archive powered by MHonArc 2.6.16.