How to know whether knife bootstrap succeeds?

Chef folks,

I am running knife bootstrap within a script, and I noticed that even though
several parts of the bootstrap obviously failed, the knife exit status is 0.
Is there some way (other than searching the console messages for strings like
ERROR) to know whether the bootstrap really succeeded?

Jeff

Hi Jeff,

AFAIK it always exits with exit-code 0 so unless you look at the output you
can't tell whether it failed. I wrote my own wrapper to launch ec2 instance,
use Chef::knife::Bootstrap's ssh_command to get the parsed template (which I
modified and added 'set -e') and use custom Net::SSH block to indicate the
exit code of the command. It was a little work, but since I use the same
process for many machine types it was worth it. If you're interested I can
post relevant parts of the code here.

Bye

On Thu, Sep 29, 2011 at 8:27 PM, jeff.stroomer@disney.com wrote:

Chef folks,

I am running knife bootstrap within a script, and I noticed that even
though
several parts of the bootstrap obviously failed, the knife exit status is
0.
Is there some way (other than searching the console messages for strings
like
ERROR) to know whether the bootstrap really succeeded?

Jeff

--
Haim

On Thu, Sep 29, 2011 at 1:41 PM, Haim Ashkenazi
haim.ashkenazi@gmail.com wrote:

AFAIK it always exits with exit-code 0 so unless you look at the output you
can't tell whether it failed. I wrote my own wrapper to launch ec2 instance,
use Chef::knife::Bootstrap's ssh_command to get the parsed template (which I
modified and added 'set -e') and use custom Net::SSH block to indicate the
exit code of the command. It was a little work, but since I use the same
process for many machine types it was worth it. If you're interested I can
post relevant parts of the code here.

There is some discussion surrounding returning exit codes from knife
on this ticket:

http://tickets.opscode.com/browse/CHEF-2627

Bryan