vagrant/plugins/provisioners/chef/scripts/cheftaskrun.ps1.erb

19 lines
610 B
Plaintext
Raw Normal View History

$exitCode = -1
Set-ExecutionPolicy Unrestricted -force;
Try
{
"running" | Out-File "<%= options[:chef_task_running] %>"
$process = (Start-Process "<%= options[:chef_binary_path] %>" -ArgumentList "<%= options[:chef_arguments] %>" -NoNewWindow -PassThru -Wait -RedirectStandardOutput "<%= options[:chef_stdout_log] %>" -RedirectStandardError "<%= options[:chef_stderr_log] %>")
$exitCode = $process.ExitCode
}
Finally
{
$exitCode | Out-File "<%= options[:chef_task_exitcode] %>"
if (Test-Path "<%= options[:chef_task_running] %>") {
del "<%= options[:chef_task_running] %>"
}
}
exit $exitCode