是否可以在ruby_block中使用powershell_script? 我想在收敛阶段运行powershell脚本而不是编译阶段。 当前的代码不起作用:厨师 - 在ruby_block中使用powershell_script
ruby_block 'ruby block so that code is run during convergence phase and not compilation phase' do
block do
buildNumber = "123"
powershell_script 'run powershell script' do
environment ({'buildNumber' => buildNumber})
code "path/to/script/script.ps1"
end
end
action :run
end
我知道你可以在powershell_script使用保护的ruby_block的外部,使其收敛过程中运行,但我需要的是Ruby块中定义的局部变量buildNumber。
请不要使用它,它确实在某些情况下无法正常工作(例如ChefSpec测试)。 – coderanger