Ok that is sorted out:
I had to add the following:
#stop execution after first error $ErrorActionPreference="Stop"
#force all error to exit with 1 trap { write-output $_ exit 1 }
This ensures that any error will exit with 1… this is not always the case! http://stackoverflow.com/questions/15777492/why-are-my-powershell-exit-codes-always-0
Strangely adding the trap also ensured that stdout and stderr is now being shown in the chef-client output.
I have never been happier to have a script break!
Cheers, flo
From: Florian Hehlen
Hi,
Thanks for that pointer.
Is there a way to pipe the output of the script back into chef? I am running a powershell script and get a “successfully run” message although it clearly has not run
Cheers, florian
From: Ranjib Dey [mailto:
yes you can, you can use the cookbook_file to dirstribute/install the script in a location (say /usr/local/foo) and use the execute resource to invoke it (execute "/usr/local/foo"),
On Fri, Jul 12, 2013 at 6:52 AM, Florian Hehlen < " target="_blank"> > wrote: HI,
I would like to include a native script and execute it from a recipe rather than in-lining it into the recipe.
Is this possiblem
Cheers, Florian
LEGAL DISCLAIMER
LEGAL DISCLAIMER
This communication and any attached documents are strictly confidential and/or legally privileged and they may not be used or disclosed by someone who is not a named recipient. If you have received this electronic communication in error please notify the sender by replying to this electronic communication inserting the word "misdirected" as the subject and delete this communication from your system. |
Archive powered by MHonArc 2.6.16.