[chef] RE: knife exit codes on windows?


Chronological Thread 
  • From: Adam Edwards < >
  • To:
  • Subject: [chef] RE: knife exit codes on windows?
  • Date: Mon, 10 Feb 2014 12:12:06 -0800

What shell are you using – I’d like to be sure this repro’s on PowerShell – I tried this myself on PowerShell and was able to repro the problem, and would like to be sure you’re also seeing it there.

 

I can’t think of a workaround at the moment – I’ve filed the ticket below:

https://tickets.opscode.com/browse/KNIFE-450

 

-Adam

 

From: Brian Anderson [mailto: "> ]
Sent: Monday, February 10, 2014 7:18 AM
To: ">
Subject: [chef] knife exit codes on windows?

 

I feel like I'm missing something obvious here.  No matter what happens in the run, knife winrm always seems to return 0.

 

To demonstrate this I did a remote run of chef-client, calling an invalid override run list.

 

First on linux:

 

~ ]$ knife ssh -m linhost -x user -i key.pem "sudo chef-client --force-logger -l info -o recipe[nosuch::recipel]"
[...]
linhost [2014-02-10T09:57:56-05:00] FATAL: Chef::Exceptions::RecipeNotFound: could not find recipe fooszl for cookbook affdex
~ ]$ echo $?
1

 

 

Then Windows:

 

knife winrm -m winhost -x Administrator -P password "chef-client --force-logger -l info -o recipe[affdex::fooszl]"
[...]
winhost [2014-02-10T09:58:33-05:00] FATAL: Chef::Exceptions::RecipeNotFound: could not find recipe fooszl for cookbook affdex
~ ]$ echo $?
0

 

Then I tried using the --returns arg to knife winrm:

 

knife winrm --returns 0 -m winhost -x Administrator -P password "chef-client --force-logger -l info -o recipe[affdex::fooszl]"
[...]
winhost [2014-02-10T09:59:03-05:00] FATAL: Chef::Exceptions::RecipeNotFound: could not find recipe fooszl for cookbook affdex
ERROR: Failed to execute command on winhost return code 1
~ ]$ echo $?
0

 

 

Is there some way that I am missing to get knife winrm to return 1 when the chef run fails, like knife ssh does?

 

 

Thanks,

 

Brian

--
Brian Anderson | Operations Engineer
Phone 781.696.1304 
http://www.finsmes.com/wp-content/uploads/2011/07/Affectiva_logo_JPG.jpg
www.affectiva.com
http://www.snoitulosten.com/wp-content/uploads/2010/01/facebook-small.jpg http://www.snoitulosten.com/wp-content/uploads/2010/01/twitter-small.jpg http://images4.wikia.nocookie.net/__cb20101115140837/finalfantasy/images/9/93/Youtube_icon_logo.gif http://brendanmitchell.files.wordpress.com/2009/03/blog-icon-200.png http://www.itprosphilly.com/wp-content/uploads/2011/08/linkedin-icon-small.png http://www.thesimplerweb.com/wp-content/uploads/2012/08/google-plus-icon.jpg?cda6c1




Archive powered by MHonArc 2.6.16.

§