Chef PowerShell Logging/Write-Host -
is there way log console chef when using powershell_script block.
an oversimplified example:
powershell_script "something cool" ignore_failure true code <<-eoh write-host "hello world" eoh end
you want mixin powershell_out, reads output powershell in same way shell_out reads other shells. according chef changelog of client 12.4.0 powershell_out lives in core chef https://github.com/chef/chef/blob/master/changelog.md
edit: got work in environment. bare in mind, i'm locked omnibus version 12.3.0 experience may differ.
in order expose powershell_out need couple things.
metadata.rb ... depends 'windows' <recipe using powershell_out>.rb ... ::chef::recipe.send(:include, chef::mixin::powershellout) #example usage should_exist = powershell_out('$true').stdout #=> ['true']
not full tutorial many bothans died bring information , hope it's useful jumping off point. oh, , doing method throws warning:
the powershell_out library in windows cookbook deprecated. please upgrade chef 12.4.0 or later built-in core chef.
so in 12.4.0+ should able use powershell_out resource directly.
Comments
Post a Comment