From 68ce06561af0776c6fe060a5a52d77266fa0ba8b Mon Sep 17 00:00:00 2001 From: Shawn Neal Date: Fri, 25 Apr 2014 15:38:14 -0700 Subject: [PATCH] Removed old unused WinRM chef provisioner scripts --- .../chef/scripts/cheftask.ps1.erb | 48 ------------------- .../chef/scripts/cheftask.xml.erb | 45 ----------------- .../chef/scripts/cheftaskrun.ps1.erb | 18 ------- 3 files changed, 111 deletions(-) delete mode 100644 plugins/provisioners/chef/scripts/cheftask.ps1.erb delete mode 100644 plugins/provisioners/chef/scripts/cheftask.xml.erb delete mode 100644 plugins/provisioners/chef/scripts/cheftaskrun.ps1.erb diff --git a/plugins/provisioners/chef/scripts/cheftask.ps1.erb b/plugins/provisioners/chef/scripts/cheftask.ps1.erb deleted file mode 100644 index f025425ff..000000000 --- a/plugins/provisioners/chef/scripts/cheftask.ps1.erb +++ /dev/null @@ -1,48 +0,0 @@ -# kill the task so we can recreate it -schtasks /delete /tn "chef-solo" /f 2>&1 | 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 - - if (Test-Path "<%= options[:chef_stdout_log] %>") { - $text = (get-content "<%= options[:chef_stdout_log] %>") - $numLines = ($text | Measure-Object -line).lines - $numLinesToRead = $numLines - $numLinesRead - - if ($numLinesToRead -gt 0) { - $text | select -first $numLinesToRead -skip $numLinesRead | ForEach { - Write-Host "$_" - } - $numLinesRead += $numLinesToRead - } - } -} - -exit Get-Content "<%= options[:chef_task_exitcode] %>" diff --git a/plugins/provisioners/chef/scripts/cheftask.xml.erb b/plugins/provisioners/chef/scripts/cheftask.xml.erb deleted file mode 100644 index 6b598ec4c..000000000 --- a/plugins/provisioners/chef/scripts/cheftask.xml.erb +++ /dev/null @@ -1,45 +0,0 @@ - - - - 2013-06-21T22:41:43 - Administrator - - - - 2045-01-01T12:00:00 - true - - - - - vagrant - Password - HighestAvailable - - - - IgnoreNew - false - false - true - false - false - - true - false - - true - true - false - false - false - PT2H - 4 - - - - powershell - -file <%= options[:chef_task_run_ps1] %> - - - diff --git a/plugins/provisioners/chef/scripts/cheftaskrun.ps1.erb b/plugins/provisioners/chef/scripts/cheftaskrun.ps1.erb deleted file mode 100644 index 0d4a43bf4..000000000 --- a/plugins/provisioners/chef/scripts/cheftaskrun.ps1.erb +++ /dev/null @@ -1,18 +0,0 @@ -$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