[chef] Re: Re: chef recipe does not fail on bash resource


Chronological Thread 
  • From: Manoj Thakkar < >
  • To: " " < >
  • Subject: [chef] Re: Re: chef recipe does not fail on bash resource
  • Date: Mon, 30 Sep 2013 14:35:25 -0700

Thanks Andy,

It helped, The tricky part is if the bash script fails the cookbook file attribute will not run in next time since the file is the same so the bash resource will not run also.

How do i make bash script run if it failed last time ? is there a feature ? or may be i shall throw a file output check the status is that file and rerun bash script no matter what.

Thanks
Manoj


On Mon, Sep 30, 2013 at 1:09 PM, Andy Gale < " target="_blank"> > wrote:
On Mon, Sep 30, 2013 at 8:17 PM, Manoj Thakkar < "> > wrote:
> Hi All,
>
> I have written this chef recipe  below,
>
> This is what i expect/require
>
> * The bash resource shall fail is the shell script i am running below fails,
> * the cookbook file should not say up to date if the bash script below fail

The shell script always completes successfully because the last
command, echo, works. You probably want to put...

"set -e"

... at the beginning which will case bash to exit when it firsts
encounters an error.

--
Andy Gale
http://andy-gale.com
http://twitter.com/andygale




Archive powered by MHonArc 2.6.16.

§