[chef] Re: Re: Chef PowerShell write-host


Chronological Thread 
  • From: Yoshi Spendiff < >
  • To: chef < >
  • Subject: [chef] Re: Re: Chef PowerShell write-host
  • Date: Thu, 14 May 2015 10:45:17 -0700

Try using the -l debug flag to your chef runs. You'll have to sift through a lot of junk but the output should be there.

Use it for debugging but don't rely on the output from the script for your recipes to work or as a regular thing for you to read.

You can use Chef::Log.<level> in your recipes for output in a Chef run.

On Thu, May 14, 2015 at 10:41 AM, Steven Murawski < " target="_blank"> > wrote:
The simple answer is, "you don't".  What's the purpose or intention?  Do you want additional logging?  If so, that's where the log resource comes into play and may suggest areas where you are doing to many steps in one powershell resource or may be a good place to build a lightweight resource provider (LWRP).

Steve

Steven Murawski
Community Software Development Engineer @ Chef
Microsoft MVP - PowerShell
http://stevenmurawski.com

On 5/8/2015 3:37:26 AM, Simon Hawkins < " target="_blank"> > wrote:

All,

 

I have a bunch of write-host statements in a powershell block in a recipe.

 

When I run the script using powershell on the local machine, the write-host output writes the messages to the console.

 

When I run it via the chef-run it doesn’t:

 

[2015-05-08T09:30:48+01:00] INFO: powershell_script[rename_hostname] ran successfully

 

    - execute "powershell.exe" -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Unrestricted -InputFormat None -File

"C:/Users/ADMINI~1/AppData/Local/Temp/1/chef-script20150508-2840-aitigl.ps1"

[2015-05-08T09:30:48+01:00] INFO: Chef Run complete in 57.125115 seconds

 

How do I get the chef-run to write the write-host commands to the console on the run?

 

Cheers,

Simon.


Disclaimer

This message is intended only for the use of the person(s) ("Intended Recipient") to whom it is addressed. It may contain information which is privileged and confidential. Accordingly any dissemination, distribution, copying or other use of this message or any of its content by any person other than the Intended Recipient may constitute a breach of civil or criminal law and is strictly prohibited. If you are not the Intended Recipient, please contact the sender as soon as possible.

Totaljobs Group Limited Registered Office: Bluefin Building, 110 Southwark Street, London, SE1 0TA, UK Registered in England and Wales under company no. 4269861





--
Yoshi Spendiff
Ops Engineer
Indochino
Mobile: +1 778 952 2025



Archive powered by MHonArc 2.6.16.

§