[chef] Powershell LWRP, returns attribute, and idempotency


Chronological Thread 
  • From: Bryan Stenson < >
  • To:
  • Subject: [chef] Powershell LWRP, returns attribute, and idempotency
  • Date: Wed, 15 May 2013 09:13:36 -0700

Ohai!

I'm trying to catch exit codes from my powershell code block to determine whether my provider has affected change (to correctly set updated_by_last_action).

I think I should be able to do this using the "returns" attribute of the Powershell LWRP, but I'm having trouble getting it to work (and I haven't found many good examples).  I can see the "returns" attribute should be either an Array or Integer of acceptable exit codes, and I've set it to my expected values.

However, no matter what my code block returns, Chef gets an exit code of "1" for all non-zero return codes from Mixlib::ShellOut::ShellCommandFailed.

Here's my sample recipe, and chef-client run error: https://gist.github.com/stensonb/5585093

Even if I successfully get a non-one error code response, how do I access this return code?

I'm hoping I'm just using it wrong.  Anybody have an example?

Bryan



Archive powered by MHonArc 2.6.16.

§