Sha256: c5e09e700e3d7356846c8368794dea2d0d740f3ff5265c438112ba742939ba19
Contents?: true
Size: 1.47 KB
Versions: 14
Compression:
Stored size: 1.47 KB
Contents
schtasks /query /tn "chef-solo" | Out-Null if ($?) { # task already exists, kill it schtasks /delete /tn "chef-solo" /f | Out-Null } # Ensure the chef task running file doesn't exist from a previous failure if (Test-Path "<%= options[:chef_task_running] %>") { del "<%= options[:chef_task_running] %>" } # schedule the task to run once in the far distant future schtasks /create /tn "chef-solo" /xml "<%= options[:chef_task_xml] %>" /ru "<%= options[:user] %>" /rp "<%= options[:pass] %>" | Out-Null # start the scheduled task right now schtasks /run /tn "chef-solo" | Out-Null # wait for run_chef.ps1 to start or timeout after 1 minute $timeoutSeconds = 60 $elapsedSeconds = 0 while ( (!(Test-Path "<%= options[:chef_task_running] %>")) -and ($elapsedSeconds -lt $timeoutSeconds) ) { Start-Sleep -s 1 $elapsedSeconds++ } if ($elapsedSeconds -ge $timeoutSeconds) { Write-Error "Timed out waiting for chef scheduled task to start" exit -2 } # read the entire file, but only write out new lines we haven't seen before $numLinesRead = 0 $success = $TRUE while (Test-Path "<%= options[:chef_task_running] %>") { Start-Sleep -m 100 $text = (get-content "<%= options[:chef_stdout_log] %>") $numLines = ($text | Measure-Object -line).lines $numLinesToRead = $numLines - $numLinesRead $text | select -first $numLinesToRead -skip $numLinesRead | ForEach { Write-Host "$_" } $numLinesRead += $numLinesToRead } exit Get-Content "<%= options[:chef_task_exitcode] %>"
Version data entries
14 entries across 14 versions & 2 rubygems