Knife return codes?


#1

I see (in my Jenkins console for example) that when knife fails I get a return code 1. Can I assume that if knife passes that it returns a 0? If no, what’s the best way to check for a pass/fail knife condition without parsing the output?

Chris


#2

On Thursday, April 30, 2015 at 11:31 AM, Fouts, Chris wrote:

I see (in my Jenkins console for example) that when knife fails I get a return code 1. Can I assume that if knife passes that it returns a 0? If no, what’s the best way to check for a pass/fail knife condition without parsing the output?

Chris

Correct, knife should always return non-zero for failure. I suppose there are ways that it could not, like if a plugin was written incorrectly, but that would be considered a bug. I’m not aware of any such bugs for core knife functionality.


Daniel DeLeo


#3

‘0’ is the standard UNIX and Linux exit code for a successful command. I spend a great deal of time with tools and systems that do not report errors, and continue blithely on their way.

Nico Kadel-Garcia
Lead DevOps Engineer
nkadel@skyhookwireless.commailto:nkadel@skyhookwireless.com

From: Fouts, Chris [mailto:Chris.Fouts@Sensus.com]
Sent: Thursday, April 30, 2015 2:31 PM
To: chef@lists.opscode.com
Subject: [chef] knife return codes?

I see (in my Jenkins console for example) that when knife fails I get a return code 1. Can I assume that if knife passes that it returns a 0? If no, what’s the best way to check for a pass/fail knife condition without parsing the output?

Chris