I'm trying to test PowershellOut in Chef in order to get some values from PS code and then save it into a ruby variable in order to use it within chef code. I have created a very simple scenario in order to test this:
Chef code:
::Chef::Resource::PowershellScript.send(:include, Chef::Mixin::PowershellOut)
testPO = <<-EOH
$varo = "new22"
$varo
EOH
newvar = powershell_out(testPO)
directory "C:\\Users\\Foo\\Desktop\\#{newvar}" do
action :delete
end
There are no "red" errors, however I've found out that there is some sort of error code within the variable itself:
directory[C:\Users\foo\Desktop#"<"Mixlib::ShellOut:0x58a8140">"]