Created
April 10, 2017 21:00
-
-
Save jbollman7/9e0974d634750af589f096ee0b01153e to your computer and use it in GitHub Desktop.
Error executing action `run` on resource 'powershell_script[Install Chocolatey]'
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ArgumentError | |
------------- | |
wrong number of arguments (given 0, expected 1) | |
PS C:\users\joseph.bollman\Desktop\LABS\Bollman_scripts\dd-windows> kitchen converge -l debug | |
-----> Starting Kitchen (v1.15.0) | |
D [Vagrant command] BEGIN (vagrant --version) | |
D [Vagrant command] END (0m0.00s) | |
D [Vagrant command] BEGIN (vagrant plugin list) | |
D [Vagrant command] END (0m0.00s) | |
D Berksfile found at C:/users/joseph.bollman/Desktop/LABS/Bollman_scripts/dd-windows/Berksfile, loading Berkshelf | |
D Berkshelf 5.6.4 library loaded | |
D winrm requested, loading winrm gem (["~> 2.0"]) | |
D winrm is loaded. | |
D winrm-fs requested, loading winrm-fs gem (["~> 1.0"]) | |
D winrm-fs is loaded. | |
D winrm-elevated requested, loading winrm-elevated gem (["~> 1.0"]) | |
D winrm-elevated is loaded. | |
-----> Converging <default-windows-2012r2>... | |
Preparing files for transfer | |
D Creating local sandbox in C:/Users/JOSEPH~1.BOL/AppData/Local/Temp/default-windows-2012r2-sandbox-20170410-10048-1okw10c | |
Preparing dna.json | |
D Creating dna.json from {:run_list=>["recipe[dd-windows::base]", "recipe[dd-windows::POSH]"]} | |
Resolving cookbook dependencies with Berkshelf 5.6.4... | |
D Using Berksfile from C:/users/joseph.bollman/Desktop/LABS/Bollman_scripts/dd-windows/Berksfile | |
Removing non-cookbook files before transfer | |
Preparing validation.pem | |
D Using a dummy validation.pem | |
Preparing client.rb | |
D Creating client.rb from {:node_name=>"default-windows-2012r2", :checksum_path=>"\#{ENV['TEMP']}\\kitchen\\checksums", :file_cache_path=>"\#{ENV['TEMP']}\\kitchen\\cache", :file_backup_path=>"\#{ENV['TEMP']}\\kitchen\\backup", :cookbook_path=>["\#{ENV['TEMP']}\\kit | |
chen\\cookbooks", "\#{ENV['TEMP']}\\kitchen\\site-cookbooks"], :data_bag_path=>"\#{ENV['TEMP']}\\kitchen\\data_bags", :environment_path=>"\#{ENV['TEMP']}\\kitchen\\environments", :node_path=>"\#{ENV['TEMP']}\\kitchen\\nodes", :role_path=>"\#{ENV['TEMP']}\\kitchen\\roles" | |
, :client_path=>"\#{ENV['TEMP']}\\kitchen\\clients", :user_path=>"\#{ENV['TEMP']}\\kitchen\\users", :validation_key=>"\#{ENV['TEMP']}\\kitchen\\validation.pem", :client_key=>"\#{ENV['TEMP']}\\kitchen\\client.pem", :chef_server_url=>"http://127.0.0.1:8889", :encrypted_dat | |
a_bag_secret=>"\#{ENV['TEMP']}\\kitchen\\encrypted_data_bag_secret", :treat_deprecation_warnings_as_errors=>false, :named_run_list=>{}} | |
D [WinRM] <{:endpoint=>"http://127.0.0.1:2200/wsman", :user=>"Administrator", :password=>"vagrant", :transport=>:negotiate, :elevated_username=>"Administrator", :elevated_password=>"vagrant", :no_ssl_peer_verification=>true, :disable_sspi=>false, :basic_auth_only=>f | |
alse}> (function Get-PlatformVersion { | |
switch -regex ((Get-WMIQuery win32_operatingsystem).version) { | |
'10\.0\.\d+' {$platform_version = '2016'} | |
'6\.3\.\d+' {$platform_version = '2012r2'} | |
'6\.2\.\d+' {$platform_version = '2012'} | |
'6\.1\.\d+' {$platform_version = '2008r2'} | |
'6\.0\.\d+' {$platform_version = '2008'} | |
} | |
if(Test-Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Server\ServerLevels') { | |
$levels = Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Server\ServerLevels' | |
if($levels.NanoServer -eq 1) { $platform_version += 'nano' } | |
} | |
return $platform_version | |
} | |
function Get-PlatformArchitecture { | |
if ((Get-WMIQuery win32_operatingsystem).osarchitecture -like '64-bit') { | |
$architecture = 'x86_64' | |
} else { | |
$architecture = 'i386' | |
} | |
return $architecture | |
} | |
function New-Uri { | |
param ($baseuri, $newuri) | |
try { | |
$base = new-object System.Uri $baseuri | |
new-object System.Uri $base, $newuri | |
} | |
catch [System.Management.Automation.MethodInvocationException]{ | |
Write-Error "$($_.exception.message)" | |
throw $_.exception | |
} | |
} | |
function Get-WebContent { | |
param ($uri, $filepath) | |
try { | |
if($PSVersionTable.PSEdition -eq 'Core') { | |
Get-WebContentOnCore $uri $filepath | |
} | |
else { | |
Get-WebContentOnFullNet $uri $filepath | |
} | |
} | |
catch { | |
$exception = $_.Exception | |
Write-Host "There was an error: " | |
do { | |
Write-Host "`t$($exception.message)" | |
$exception = $exception.innerexception | |
} while ($exception) | |
throw "Failed to download from $uri." | |
} | |
} | |
function Get-WebContentOnFullNet { | |
param ($uri, $filepath) | |
$proxy = New-Object -TypeName System.Net.WebProxy | |
$wc = new-object System.Net.WebClient | |
$wc.Headers.Add("user-agent", "mixlib-install/2.1.11") | |
$proxy.Address = $env:http_proxy | |
$wc.Proxy = $proxy | |
if ([string]::IsNullOrEmpty($filepath)) { | |
$wc.downloadstring($uri) | |
} | |
else { | |
$wc.downloadfile($uri, $filepath) | |
} | |
} | |
function Get-WebContentOnCore { | |
param ($uri, $filepath) | |
$handler = New-Object System.Net.Http.HttpClientHandler | |
$client = New-Object System.Net.Http.HttpClient($handler) | |
$client.DefaultRequestHeaders.UserAgent.ParseAdd("mixlib-install/2.1.11") | |
$client.Timeout = New-Object System.TimeSpan(0, 30, 0) | |
$cancelTokenSource = [System.Threading.CancellationTokenSource]::new() | |
$responseMsg = $client.GetAsync([System.Uri]::new($uri), $cancelTokenSource.Token) | |
$responseMsg.Wait() | |
if (!$responseMsg.IsCanceled) { | |
$response = $responseMsg.Result | |
if ($response.IsSuccessStatusCode) { | |
if ([string]::IsNullOrEmpty($filepath)) { | |
$response.Content.ReadAsStringAsync().Result | |
} | |
else { | |
$downloadedFileStream = [System.IO.FileStream]::new($filepath, [System.IO.FileMode]::Create, [System.IO.FileAccess]::Write) | |
$copyStreamOp = $response.Content.CopyToAsync($downloadedFileStream) | |
$copyStreamOp.Wait() | |
$downloadedFileStream.Close() | |
if ($copyStreamOp.Exception -ne $null) { | |
throw $copyStreamOp.Exception | |
} | |
} | |
} | |
} | |
} | |
function Test-ProjectPackage { | |
[cmdletbinding()] | |
param ($Path, $Algorithm = 'SHA256', $Hash) | |
if (-not (get-command get-filehash -ErrorAction 'SilentlyContinue')) { | |
function disposable($o){($o -is [IDisposable]) -and (($o | get-member | foreach-object {$_.name}) -contains 'Dispose')} | |
function use($obj, [scriptblock]$sb){try {& $sb} catch [exception]{throw $_} finally {if (disposable $obj) {$obj.Dispose()}} } | |
function Get-FileHash ($Path, $Algorithm) { | |
$Path = (resolve-path $path).providerpath | |
$hash = @{Algorithm = $Algorithm; Path = $Path} | |
use ($c = Get-SHA256Converter) { | |
use ($in = (gi $path).OpenRead()) { | |
$hash.Hash = ([BitConverter]::ToString($c.ComputeHash($in))).Replace("-", "").ToUpper() | |
} | |
} | |
new-object PSObject -Property $hash | |
} | |
} | |
Write-Verbose "Testing the $Algorithm hash for $path." | |
$ActualHash = (Get-FileHash -Algorithm $Algorithm -Path $Path).Hash.ToLower() | |
Write-Verbose "`tDesired Hash - '$hash'" | |
Write-Verbose "`tActual Hash - '$ActualHash'" | |
$Valid = $ActualHash -eq $Hash | |
if (-not $Valid) { | |
Write-Error "Failed to validate the downloaded installer. The expected $Algorithm hash was '$Hash' and the actual hash was '$ActualHash' for $path" | |
} | |
return $Valid | |
} | |
function Get-SHA256Converter { | |
if($PSVersionTable.PSEdition -eq 'Core') { | |
[System.Security.Cryptography.SHA256]::Create() | |
} | |
else { | |
New-Object -TypeName Security.Cryptography.SHA256Managed | |
} | |
} | |
function Get-WMIQuery { | |
param ($class) | |
if(Get-Command -Name Get-CimInstance -ErrorAction SilentlyContinue) { | |
Get-CimInstance $class | |
} | |
else { | |
Get-WmiObject $class | |
} | |
} | |
$platform_architecture = Get-PlatformArchitecture | |
$platform_version = Get-PlatformVersion | |
$chef_omnibus_root = "$env:systemdrive\opscode\chef" | |
$msi = "/omnibus/cache\chef-true.msi" | |
$download_directory = "/omnibus/cache" | |
$chef_metadata_url = "https://omnitruck.chef.io/metadata?p=windows&m=$platform_architecture&pv=$platform_version" | |
$pretty_version = "install only if missing" | |
$version = "true" | |
Function Check-UpdateChef($root, $version) { | |
if (-Not (Test-Path "$root\embedded")) { return $true } | |
elseif ("$version" -eq "true") { return $false } | |
elseif ("$version" -eq "latest") { return $true } | |
Try { $chef_version = (Get-Content $root\version-manifest.txt -ErrorAction stop | select-object -first 1) } | |
Catch { | |
Try { $chef_version = (& $root\bin\chef-solo.bat -v) } | |
Catch { $chef_version = " " } | |
} | |
if ($chef_version.split(" ", 2)[1].StartsWith($version)) { return $false } | |
else { return $true } | |
} | |
Function Get-ChefMetadata($url) { | |
$response = Get-WebContent $url | |
$md = ConvertFrom-StringData $response.Replace("`t", "=") | |
return @($md.url, $md.sha256) | |
} | |
Function Get-SHA256($src) { | |
Try { | |
$c = Get-SHA256Converter | |
$bytes = $c.ComputeHash(($in = (Get-Item $src).OpenRead())) | |
return ([System.BitConverter]::ToString($bytes)).Replace("-", "").ToLower() | |
} Finally { if (($c -ne $null) -and ($c.GetType().GetMethod("Dispose") -ne $null)) { $c.Dispose() }; if ($in -ne $null) { $in.Dispose() } } | |
} | |
function Get-SHA256Converter { | |
if($PSVersionTable.PSEdition -eq 'Core') { | |
[System.Security.Cryptography.SHA256]::Create() | |
} | |
else { | |
New-Object -TypeName Security.Cryptography.SHA256Managed | |
} | |
} | |
Function Download-Chef($url, $sha256, $dst) { | |
Log "Downloading package from $url" | |
Get-WebContent $url $dst | |
Log "Download complete." | |
if ($sha256 -eq $null) { Log "Skipping sha256 verification" } | |
elseif (Verify-SHA256 $dst $sha256) { Log "Successfully verified $dst" } | |
else { throw "SHA256 for $dst does not match $sha256" } | |
} | |
Function Verify-SHA256($path, $sha256) { | |
if ($sha256 -eq $null) { return $false } | |
elseif (($dsha256 = Get-SHA256 $path) -eq $sha256) { return $true } | |
else { return $false } | |
} | |
Function Install-Chef($msi, $chef_omnibus_root) { | |
Log "Installing Chef Omnibus package $msi" | |
$installingChef = $True | |
$installAttempts = 0 | |
while ($installingChef) { | |
$installAttempts++ | |
$result = $false | |
if($msi.EndsWith(".appx")) { | |
$result = Install-ChefAppx $msi $chef_omnibus_root | |
} | |
else { | |
$result = Install-ChefMsi $msi | |
} | |
if(!$result) { continue } | |
$installingChef = $False | |
} | |
Log "Installation complete" | |
} | |
Function Install-ChefMsi($msi) { | |
$p = Start-Process -FilePath "msiexec.exe" -ArgumentList "/qn /i $msi" -Passthru -Wait | |
$p.WaitForExit() | |
if ($p.ExitCode -eq 1618) { | |
Log "Another msi install is in progress (exit code 1618), retrying ($($installAttempts))..." | |
return $false | |
} elseif ($p.ExitCode -ne 0) { | |
throw "msiexec was not successful. Received exit code $($p.ExitCode)" | |
} | |
return $true | |
} | |
Function Install-ChefAppx($appx, $chef_omnibus_root) { | |
Add-AppxPackage -Path $appx -ErrorAction Stop | |
$rootParent = Split-Path $chef_omnibus_root -Parent | |
if(!(Test-Path $rootParent)) { | |
New-Item -ItemType Directory -Path $rootParent | |
} | |
# Remove old version of chef if it is here | |
if(Test-Path $chef_omnibus_root) { | |
Remove-Item -Path $chef_omnibus_root -Recurse -Force | |
} | |
# copy the appx install to the omnibus_root. There are serious | |
# ACL related issues with running chef from the appx InstallLocation | |
# Hoping this is temporary and we can eventually just symlink | |
$package = (Get-AppxPackage -Name chef).InstallLocation | |
Copy-Item $package $chef_omnibus_root -Recurse | |
return $true | |
} | |
Function Log($m) { Write-Host " $m" } | |
function Get-WebContent { | |
param ($uri, $filepath) | |
try { | |
if($PSVersionTable.PSEdition -eq 'Core') { | |
Get-WebContentOnCore $uri $filepath | |
} | |
else { | |
Get-WebContentOnFullNet $uri $filepath | |
} | |
} | |
catch { | |
$exception = $_.Exception | |
Write-Host "There was an error: " | |
do { | |
Write-Host "`t$($exception.message)" | |
$exception = $exception.innerexception | |
} while ($exception) | |
throw "Failed to download from $uri." | |
} | |
} | |
function Get-WebContentOnFullNet { | |
param ($uri, $filepath) | |
$proxy = New-Object -TypeName System.Net.WebProxy | |
$wc = new-object System.Net.WebClient | |
$proxy.Address = $env:http_proxy | |
$wc.Proxy = $proxy | |
if ([string]::IsNullOrEmpty($filepath)) { | |
$wc.downloadstring($uri) | |
} | |
else { | |
$wc.downloadfile($uri, $filepath) | |
} | |
} | |
function Get-WebContentOnCore { | |
param ($uri, $filepath) | |
$handler = New-Object System.Net.Http.HttpClientHandler | |
$client = New-Object System.Net.Http.HttpClient($handler) | |
$client.Timeout = New-Object System.TimeSpan(0, 30, 0) | |
$cancelTokenSource = [System.Threading.CancellationTokenSource]::new() | |
$responseMsg = $client.GetAsync([System.Uri]::new($uri), $cancelTokenSource.Token) | |
$responseMsg.Wait() | |
if (!$responseMsg.IsCanceled) { | |
$response = $responseMsg.Result | |
if ($response.IsSuccessStatusCode) { | |
if ([string]::IsNullOrEmpty($filepath)) { | |
$response.Content.ReadAsStringAsync().Result | |
} | |
else { | |
$downloadedFileStream = [System.IO.FileStream]::new($filepath, [System.IO.FileMode]::Create, [System.IO.FileAccess]::Write) | |
$copyStreamOp = $response.Content.CopyToAsync($downloadedFileStream) | |
$copyStreamOp.Wait() | |
$downloadedFileStream.Close() | |
if ($copyStreamOp.Exception -ne $null) { | |
throw $copyStreamOp.Exception | |
} | |
} | |
} | |
} | |
} | |
Function Unresolve-Path($p) { | |
if ($p -eq $null) { return $null } | |
else { return $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($p) } | |
} | |
$chef_omnibus_root = Unresolve-Path $chef_omnibus_root | |
if (Check-UpdateChef $chef_omnibus_root $version) { | |
Write-Host "-----> Installing Chef Omnibus ($pretty_version)" | |
if ($chef_metadata_url -ne $null) { | |
$url, $sha256 = Get-ChefMetadata "$chef_metadata_url" | |
} else { | |
$url = $chef_msi_url | |
$sha256 = $null | |
} | |
$msi = Join-Path $download_directory "$url".Split("/")[-1] | |
$msi = Unresolve-Path $msi | |
if (Verify-SHA256 $msi $sha256) { | |
Log "Skipping package download; found a matching package at $msi" | |
} else { | |
Download-Chef "$url" $sha256 $msi | |
} | |
Install-Chef $msi $chef_omnibus_root | |
} else { | |
Write-Host "-----> Chef Omnibus installation detected ($pretty_version)" | |
} | |
) | |
D [WinRM] opening remote shell on http://127.0.0.1:2200/wsman | |
D [WinRM] Waiting for output... | |
D [WinRM] Processing output | |
D [WinRM] polling for pipeline state. message: #<WinRM::PSRP::Message:0x39d8e28 @data="\xEF\xBB\xBF<Obj RefId=\"0\"><MS><Version N=\"protocolversion\">2.2</Version><Version N=\"PSVersion\">2.0</Version><Version N=\"SerializationVersion\">1.1.0.1</Version></MS></Obj> | |
", @destination=1, @type=65538, @pipeline_id="00000000-0000-0000-0000-000000000000", @runspace_pool_id="00000000-0000-0000-0000-000000000000"> | |
D [WinRM] polling for pipeline state. message: #<WinRM::PSRP::Message:0x39d2288 @data="\xEF\xBB\xBF<Obj RefId=\"0\"><MS><Obj N=\"ApplicationPrivateData\" RefId=\"1\"><TN RefId=\"0\"><T>System.Management.Automation.PSPrimitiveDictionary</T><T>System.Collections.Hasht | |
able</T><T>System.Object</T></TN><DCT><En><S N=\"Key\">DebugMode</S><I32 N=\"Value\">1</I32></En><En><S N=\"Key\">DebugStop</S><B N=\"Value\">false</B></En><En><S N=\"Key\">PSVersionTable</S><Obj N=\"Value\" RefId=\"2\"><TNRef RefId=\"0\" /><DCT><En><S N=\"Key\">PSVersio | |
n</S><Version N=\"Value\">2.0</Version></En><En><S N=\"Key\">PSCompatibleVersions</S><Obj N=\"Value\" RefId=\"3\"><TN RefId=\"1\"><T>System.Version[]</T><T>System.Array</T><T>System.Object</T></TN><LST><Version>1.0</Version><Version>2.0</Version><Version>3.0</Version><Ve | |
rsion>4.0</Version></LST></Obj></En><En><S N=\"Key\">BuildVersion</S><Version N=\"Value\">6.3.9600.17400</Version></En><En><S N=\"Key\">CLRVersion</S><Version N=\"Value\">4.0.30319.42000</Version></En><En><S N=\"Key\">WSManStackVersion</S><Version N=\"Value\">3.0</Versio | |
n></En><En><S N=\"Key\">PSRemotingProtocolVersion</S><Version N=\"Value\">2.2</Version></En><En><S N=\"Key\">SerializationVersion</S><Version N=\"Value\">1.1.0.1</Version></En></DCT></Obj></En><En><S N=\"Key\">DebugBreakpointCount</S><I32 N=\"Value\">0</I32></En></DCT></ | |
Obj></MS></Obj>", @destination=1, @type=135177, @pipeline_id="00000000-0000-0000-0000-000000000000", @runspace_pool_id="00000000-0000-0000-0000-000000000000"> | |
D [WinRM] Waiting for output... | |
D [WinRM] Processing output | |
D [WinRM] polling for pipeline state. message: #<WinRM::PSRP::Message:0x307b5e8 @data="\xEF\xBB\xBF<Obj RefId=\"0\"><MS><I32 N=\"RunspaceState\">2</I32></MS></Obj>", @destination=1, @type=135173, @pipeline_id="00000000-0000-0000-0000-000000000000", @runspace_pool_id | |
="00000000-0000-0000-0000-000000000000"> | |
D [WinRM] remote shell created with shell_id: 223870FC-6D72-4B6B-9A9C-60476057A297 | |
D [WinRM] Command created for $env:temp | |
if (!$?) { if($LASTEXITCODE) { exit $LASTEXITCODE } else { exit 1 } } with id: 78DD3C51-2330-49A2-88C1-4BB55D7EB0CA | |
D [WinRM] creating command_id: 78DD3C51-2330-49A2-88C1-4BB55D7EB0CA on shell_id 223870FC-6D72-4B6B-9A9C-60476057A297 | |
D [WinRM] Waiting for output... | |
D [WinRM] Processing output | |
D [WinRM] cleaning up command_id: 78DD3C51-2330-49A2-88C1-4BB55D7EB0CA on shell_id 223870FC-6D72-4B6B-9A9C-60476057A297 | |
D creating hash for file c:/windows/temp/winrm-elevated-shell-8786fc80-32fa-4070-a0dd-5e4ad77b591b.ps1 | |
D Running check_files.ps1 | |
D [WinRM] opening remote shell on http://127.0.0.1:2200/wsman | |
D [WinRM] Waiting for output... | |
D [WinRM] Processing output | |
D [WinRM] polling for pipeline state. message: #<WinRM::PSRP::Message:0x4f415a0 @data="\xEF\xBB\xBF<Obj RefId=\"0\"><MS><Version N=\"protocolversion\">2.2</Version><Version N=\"PSVersion\">2.0</Version><Version N=\"SerializationVersion\">1.1.0.1</Version></MS></Obj> | |
", @destination=1, @type=65538, @pipeline_id="00000000-0000-0000-0000-000000000000", @runspace_pool_id="00000000-0000-0000-0000-000000000000"> | |
D [WinRM] polling for pipeline state. message: #<WinRM::PSRP::Message:0x4f40538 @data="\xEF\xBB\xBF<Obj RefId=\"0\"><MS><Obj N=\"ApplicationPrivateData\" RefId=\"1\"><TN RefId=\"0\"><T>System.Management.Automation.PSPrimitiveDictionary</T><T>System.Collections.Hasht | |
able</T><T>System.Object</T></TN><DCT><En><S N=\"Key\">DebugMode</S><I32 N=\"Value\">1</I32></En><En><S N=\"Key\">DebugStop</S><B N=\"Value\">false</B></En><En><S N=\"Key\">PSVersionTable</S><Obj N=\"Value\" RefId=\"2\"><TNRef RefId=\"0\" /><DCT><En><S N=\"Key\">PSVersio | |
n</S><Version N=\"Value\">2.0</Version></En><En><S N=\"Key\">PSCompatibleVersions</S><Obj N=\"Value\" RefId=\"3\"><TN RefId=\"1\"><T>System.Version[]</T><T>System.Array</T><T>System.Object</T></TN><LST><Version>1.0</Version><Version>2.0</Version><Version>3.0</Version><Ve | |
rsion>4.0</Version></LST></Obj></En><En><S N=\"Key\">BuildVersion</S><Version N=\"Value\">6.3.9600.17400</Version></En><En><S N=\"Key\">CLRVersion</S><Version N=\"Value\">4.0.30319.42000</Version></En><En><S N=\"Key\">WSManStackVersion</S><Version N=\"Value\">3.0</Versio | |
n></En><En><S N=\"Key\">PSRemotingProtocolVersion</S><Version N=\"Value\">2.2</Version></En><En><S N=\"Key\">SerializationVersion</S><Version N=\"Value\">1.1.0.1</Version></En></DCT></Obj></En><En><S N=\"Key\">DebugBreakpointCount</S><I32 N=\"Value\">0</I32></En></DCT></ | |
Obj></MS></Obj>", @destination=1, @type=135177, @pipeline_id="00000000-0000-0000-0000-000000000000", @runspace_pool_id="00000000-0000-0000-0000-000000000000"> | |
D [WinRM] Waiting for output... | |
D [WinRM] Processing output | |
D [WinRM] polling for pipeline state. message: #<WinRM::PSRP::Message:0x48b0250 @data="\xEF\xBB\xBF<Obj RefId=\"0\"><MS><I32 N=\"RunspaceState\">2</I32></MS></Obj>", @destination=1, @type=135173, @pipeline_id="00000000-0000-0000-0000-000000000000", @runspace_pool_id | |
="00000000-0000-0000-0000-000000000000"> | |
D [WinRM] remote shell created with shell_id: 9221BECA-B4A4-441C-B94D-F537466FCB65 | |
D [WinRM] Command created for $hash_file = @{ | |
"6033a3e3483809aabc31093346cf62ca" = @{ | |
"target" = "c:/windows/temp/winrm-elevated-shell-8786fc80-32fa-4070-a0dd-5e4ad77b591b.ps1"; | |
"src_basename" = "winrm-elevated-shell20170410-10048-5jmgvkps1"; | |
"dst" = "c:/windows/temp/winrm-elevated-shell-8786fc80-32fa-4070-a0dd-5e4ad77b591b.ps1" | |
} | |
} | |
Function Cleanup($disposable) { | |
if (($disposable -ne $null) -and ($disposable.GetType().GetMethod("Dispose") -ne $null)) { | |
$disposable.Dispose() | |
} | |
} | |
Function Check-Files($h) { | |
return $h.GetEnumerator() | ForEach-Object { | |
$dst = Unresolve-Path $_.Value.target | |
$dst_changed = $false | |
if(Test-Path $dst -PathType Container) { | |
$dst_changed = $true | |
$dst = Join-Path $dst $_.Value.src_basename | |
} | |
New-Object psobject -Property @{ | |
chk_exists = ($exists = Test-Path $dst -PathType Leaf) | |
src_md5 = ($sMd5 = $_.Key) | |
dst_md5 = ($dMd5 = if ($exists) { Get-MD5Sum $dst } else { $null }) | |
chk_dirty = ($dirty = if ($sMd5 -ne $dMd5) { $true } else { $false }) | |
verifies = if ($dirty -eq $false) { $true } else { $false } | |
target_is_folder = $dst_changed | |
} | |
} | Select-Object -Property chk_exists,src_md5,dst_md5,chk_dirty,verifies,target_is_folder | |
} | |
Function Get-MD5Sum($src) { | |
Try { | |
$c = [System.Security.Cryptography.MD5]::Create() | |
$bytes = $c.ComputeHash(($in = (Get-Item $src).OpenRead())) | |
return ([System.BitConverter]::ToString($bytes)).Replace("-", "").ToLower() | |
} | |
Finally { | |
Cleanup $c | |
Cleanup $in | |
} | |
} | |
Function Unresolve-Path($path) { | |
if ($path -eq $null) { | |
return $null | |
} | |
else { | |
return $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($path) | |
} | |
} | |
Check-Files $hash_file | ConvertTo-Csv -NoTypeInformation | |
if (!$?) { if($LASTEXITCODE) { exit $LASTEXITCODE } else { exit 1 } } with id: CDBF228F-B26D-4247-B75B-155E7FAF05FA | |
D [WinRM] creating command_id: CDBF228F-B26D-4247-B75B-155E7FAF05FA on shell_id 9221BECA-B4A4-441C-B94D-F537466FCB65 | |
D [WinRM] Waiting for output... | |
D [WinRM] Processing output | |
D [WinRM] cleaning up command_id: CDBF228F-B26D-4247-B75B-155E7FAF05FA on shell_id 9221BECA-B4A4-441C-B94D-F537466FCB65 | |
D Parsing CSV Response | |
D "chk_exists","src_md5","dst_md5","chk_dirty","verifies","target_is_folder" | |
"False","6033a3e3483809aabc31093346cf62ca",,"True","False","False" | |
D Uploading C:/Users/JOSEPH~1.BOL/AppData/Local/Temp/winrm-elevated-shell20170410-10048-5jmgvkps1 to c:/windows/temp/winrm-elevated-shell-8786fc80-32fa-4070-a0dd-5e4ad77b591b.ps1 | |
D [WinRM] Command created for $to = $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath("c:/windows/temp/winrm-elevated-shell-8786fc80-32fa-4070-a0dd-5e4ad77b591b.ps1") | |
$parent = Split-Path $to | |
if(!(Test-path $parent)) { mkdir $parent | Out-Null } | |
$fileStream = New-Object -TypeName System.IO.FileStream -ArgumentList @( | |
$to, | |
[system.io.filemode]::Create, | |
[System.io.FileAccess]::Write, | |
[System.IO.FileShare]::ReadWrite | |
) | |
# Powershell caches ScrpitBlocks in a dictionary | |
# keyed on the script block text. Thats just great | |
# unless the script is super large and called a gillion | |
# times like we might do. In such a case it will saturate the | |
# Large Object Heap and lead to Out Of Memory exceptions | |
# for large files or folders. So we call the internal method | |
# ClearScriptBlockCache to clear it. | |
$bindingFlags= [Reflection.BindingFlags] "NonPublic,Static" | |
$method = [scriptblock].GetMethod("ClearScriptBlockCache", $bindingFlags) | |
if (!$?) { if($LASTEXITCODE) { exit $LASTEXITCODE } else { exit 1 } } with id: 98C640B9-4374-428F-AA0C-FCF36E0B21FF | |
D [WinRM] creating command_id: 98C640B9-4374-428F-AA0C-FCF36E0B21FF on shell_id 9221BECA-B4A4-441C-B94D-F537466FCB65 | |
D [WinRM] Waiting for output... | |
D [WinRM] Processing output | |
D [WinRM] cleaning up command_id: 98C640B9-4374-428F-AA0C-FCF36E0B21FF on shell_id 9221BECA-B4A4-441C-B94D-F537466FCB65 | |
D [WinRM] Command created for if($method) { $method.Invoke($Null, $Null) } | |
$bytes=[Convert]::FromBase64String('JGVudjp0ZW1wPSdDOlxVc2Vyc1xBRE1JTkl+MVxBcHBEYXRhXExvY2FsXFRlbXAnO2Z1bmN0aW9uIEdldC1QbGF0Zm9ybVZlcnNpb24gew0KICBzd2l0Y2ggLXJlZ2V4ICgoR2V0LVdNSVF1ZXJ5IHdpbjMyX29wZXJhdGluZ3N5c3RlbSkudmVyc2lvbikgew0KICAgICcxMFwuMFwuXGQrJyB7JHB | |
sYXRmb3JtX3ZlcnNpb24gPSAnMjAxNid9DQogICAgJzZcLjNcLlxkKycgIHskcGxhdGZvcm1fdmVyc2lvbiA9ICcyMDEycjInfQ0KICAgICc2XC4yXC5cZCsnICB7JHBsYXRmb3JtX3ZlcnNpb24gPSAnMjAxMid9DQogICAgJzZcLjFcLlxkKycgIHskcGxhdGZvcm1fdmVyc2lvbiA9ICcyMDA4cjInfQ0KICAgICc2XC4wXC5cZCsnICB7JHBsYXRmb3JtX3Zlcn | |
Npb24gPSAnMjAwOCd9DQogIH0NCg0KICBpZihUZXN0LVBhdGggJ0hLTE06XFNPRlRXQVJFXE1p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IkdXJsIiAkc2hhMjU2ICRtc2kNCiAgfQ0KICBJbnN0YWxsLUNoZWYgJG1zaSAkY2hlZl9vbW5pYnVzX3Jvb3QNCn0gZWxzZSB7DQogIFdyaXRlLUhvc3QgIi0tLS0tPiBDaGVmIE9tbmlidXMgaW5zdGFsbGF0aW9uIGRldGVjdGVkICgkcHJldHR5X3ZlcnNpb24pIg0KfQ0KDQ0KJEhvc3 | |
QuU2V0U2hvdWxkRXhpdCgkTEFTVEVYSVRDT0RFKQ==') | |
$fileStream.Write($bytes, 0, $bytes.length) | |
if (!$?) { if($LASTEXITCODE) { exit $LASTEXITCODE } else { exit 1 } } with id: 1222A33A-9570-482E-9294-51F9CC0A0010 | |
D [WinRM] creating command_id: 1222A33A-9570-482E-9294-51F9CC0A0010 on shell_id 9221BECA-B4A4-441C-B94D-F537466FCB65 | |
D [WinRM] Waiting for output... | |
D [WinRM] Processing output | |
D [WinRM] cleaning up command_id: 1222A33A-9570-482E-9294-51F9CC0A0010 on shell_id 9221BECA-B4A4-441C-B94D-F537466FCB65 | |
D [WinRM] Command created for $fileStream.Dispose() | |
if (!$?) { if($LASTEXITCODE) { exit $LASTEXITCODE } else { exit 1 } } with id: E6E50F74-9BD0-46B9-929D-3B914987B8CA | |
D [WinRM] creating command_id: E6E50F74-9BD0-46B9-929D-3B914987B8CA on shell_id 9221BECA-B4A4-441C-B94D-F537466FCB65 | |
D [WinRM] Waiting for output... | |
D [WinRM] Processing output | |
D [WinRM] cleaning up command_id: E6E50F74-9BD0-46B9-929D-3B914987B8CA on shell_id 9221BECA-B4A4-441C-B94D-F537466FCB65 | |
D Finished uploading C:/Users/JOSEPH~1.BOL/AppData/Local/Temp/winrm-elevated-shell20170410-10048-5jmgvkps1 to c:/windows/temp/winrm-elevated-shell-8786fc80-32fa-4070-a0dd-5e4ad77b591b.ps1 (15.708 KB over 1 chunks) in (0m0.31s) | |
D No remote files to extract, skipping | |
D Uploaded 1 items dirty_check: (0m0.53s) stream_files: (0m0.31s) extract: (0m0.00s) | |
D [WinRM] Command created for $username = 'Administrator' | |
$password = 'vagrant' | |
$script_file = 'c:/windows/temp/winrm-elevated-shell-8786fc80-32fa-4070-a0dd-5e4ad77b591b.ps1' | |
$interactive = 'false' | |
$pass_to_use = $password | |
$logon_type = 1 | |
$logon_type_xml = "<LogonType>Password</LogonType>" | |
if($pass_to_use.length -eq 0) { | |
$pass_to_use = $null | |
$logon_type = 5 | |
$logon_type_xml = "" | |
} | |
if($interactive -eq 'true') { | |
$logon_type = 3 | |
$logon_type_xml = "<LogonType>InteractiveTokenOrPassword</LogonType>" | |
} | |
$task_name = "WinRM_Elevated_Shell" | |
$out_file = [System.IO.Path]::GetTempFileName() | |
$err_file = [System.IO.Path]::GetTempFileName() | |
$task_xml = @' | |
<?xml version="1.0" encoding="UTF-16"?> | |
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task"> | |
<Principals> | |
<Principal id="Author"> | |
<UserId>{username}</UserId> | |
{logon_type} | |
<RunLevel>HighestAvailable</RunLevel> | |
</Principal> | |
</Principals> | |
<Settings> | |
<MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy> | |
<DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries> | |
<StopIfGoingOnBatteries>false</StopIfGoingOnBatteries> | |
<AllowHardTerminate>true</AllowHardTerminate> | |
<StartWhenAvailable>false</StartWhenAvailable> | |
<RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable> | |
<IdleSettings> | |
<StopOnIdleEnd>false</StopOnIdleEnd> | |
<RestartOnIdle>false</RestartOnIdle> | |
</IdleSettings> | |
<AllowStartOnDemand>true</AllowStartOnDemand> | |
<Enabled>true</Enabled> | |
<Hidden>false</Hidden> | |
<RunOnlyIfIdle>false</RunOnlyIfIdle> | |
<WakeToRun>false</WakeToRun> | |
<ExecutionTimeLimit>PT24H</ExecutionTimeLimit> | |
<Priority>4</Priority> | |
</Settings> | |
<Actions Context="Author"> | |
<Exec> | |
<Command>cmd</Command> | |
<Arguments>{arguments}</Arguments> | |
</Exec> | |
</Actions> | |
</Task> | |
'@ | |
$arguments = "/c powershell.exe -executionpolicy bypass -NoProfile -File $script_file > $out_file 2>$err_file" | |
$task_xml = $task_xml.Replace("{arguments}", $arguments) | |
$task_xml = $task_xml.Replace("{username}", $username) | |
$task_xml = $task_xml.Replace("{logon_type}", $logon_type_xml) | |
$schedule = New-Object -ComObject "Schedule.Service" | |
$schedule.Connect() | |
$task = $schedule.NewTask($null) | |
$task.XmlText = $task_xml | |
$folder = $schedule.GetFolder("\") | |
$folder.RegisterTaskDefinition($task_name, $task, 6, $username, $pass_to_use, $logon_type, $null) | Out-Null | |
$registered_task = $folder.GetTask("\$task_name") | |
$registered_task.Run($null) | Out-Null | |
$timeout = 10 | |
$sec = 0 | |
while ( (!($registered_task.state -eq 4)) -and ($sec -lt $timeout) ) { | |
Start-Sleep -s 1 | |
$sec++ | |
} | |
function SlurpOutput($file, $cur_line, $out_type) { | |
if (Test-Path $file) { | |
get-content $file | select -skip $cur_line | ForEach { | |
$cur_line += 1 | |
if ($out_type -eq 'err') { | |
$host.ui.WriteErrorLine("$_") | |
} else { | |
$host.ui.WriteLine("$_") | |
} | |
} | |
} | |
return $cur_line | |
} | |
$err_cur_line = 0 | |
$out_cur_line = 0 | |
do { | |
Start-Sleep -m 100 | |
$out_cur_line = SlurpOutput $out_file $out_cur_line 'out' | |
$err_cur_line = SlurpOutput $err_file $err_cur_line 'err' | |
} while (!($registered_task.state -eq 3)) | |
# We'll make a best effort to clean these files | |
# But a reboot could possibly end the task while the process | |
# still runs and locks the file. If we can't delete we don't want to fail | |
try { Remove-Item $out_file -ErrorAction Stop } catch {} | |
try { Remove-Item $err_file -ErrorAction Stop } catch {} | |
try { Remove-Item $script_file -ErrorAction Stop } catch {} | |
$exit_code = $registered_task.LastTaskResult | |
[System.Runtime.Interopservices.Marshal]::ReleaseComObject($schedule) | Out-Null | |
exit $exit_code | |
if (!$?) { if($LASTEXITCODE) { exit $LASTEXITCODE } else { exit 1 } } with id: BBC8FCC1-AB3F-4B22-976F-991CA0F4D16D | |
D [WinRM] creating command_id: BBC8FCC1-AB3F-4B22-976F-991CA0F4D16D on shell_id 9221BECA-B4A4-441C-B94D-F537466FCB65 | |
D [WinRM] Waiting for output... | |
D [WinRM] Processing output | |
-----> Chef Omnibus installation detected (install only if missing) | |
D [WinRM] cleaning up command_id: BBC8FCC1-AB3F-4B22-976F-991CA0F4D16D on shell_id 9221BECA-B4A4-441C-B94D-F537466FCB65 | |
D [WinRM] <{:endpoint=>"http://127.0.0.1:2200/wsman", :user=>"Administrator", :password=>"vagrant", :transport=>:negotiate, :elevated_username=>"Administrator", :elevated_password=>"vagrant", :no_ssl_peer_verification=>true, :disable_sspi=>false, :basic_auth_only=>f | |
alse}> ($env:TEST_KITCHEN = "1" | |
$dirs = @("$env:TEMP\kitchen\clients", "$env:TEMP\kitchen\cookbooks", "$env:TEMP\kitchen\data", "$env:TEMP\kitchen\data_bags", "$env:TEMP\kitchen\encrypted_data_bag_secret", "$env:TEMP\kitchen\environments", "$env:TEMP\kitchen\roles") | |
$root_path = "$env:TEMP\kitchen" | |
Function Delete-AllDirs($dirs) { | |
$dirs | ForEach-Object { | |
if (Test-Path ($path = Unresolve-Path $_)) { Remove-Item $path -Recurse -Force } | |
} | |
} | |
Function Unresolve-Path($p) { | |
if ($p -eq $null) { return $null } | |
else { return $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($p) } | |
} | |
Function Make-RootPath($p) { | |
$p = Unresolve-Path $p | |
if (-Not (Test-Path $p)) { New-Item $p -ItemType directory | Out-Null } | |
} | |
Delete-AllDirs $dirs | |
Make-RootPath $root_path | |
) | |
D creating hash for file c:/windows/temp/winrm-elevated-shell-9f77bde7-c94f-499d-9e36-b48dded9dafb.ps1 | |
D Running check_files.ps1 | |
D [WinRM] Command created for $hash_file = @{ | |
"004bc4f2a1c46004537879ada398ea86" = @{ | |
"target" = "c:/windows/temp/winrm-elevated-shell-9f77bde7-c94f-499d-9e36-b48dded9dafb.ps1"; | |
"src_basename" = "winrm-elevated-shell20170410-10048-fzsu46ps1"; | |
"dst" = "c:/windows/temp/winrm-elevated-shell-9f77bde7-c94f-499d-9e36-b48dded9dafb.ps1" | |
} | |
} | |
Function Cleanup($disposable) { | |
if (($disposable -ne $null) -and ($disposable.GetType().GetMethod("Dispose") -ne $null)) { | |
$disposable.Dispose() | |
} | |
} | |
Function Check-Files($h) { | |
return $h.GetEnumerator() | ForEach-Object { | |
$dst = Unresolve-Path $_.Value.target | |
$dst_changed = $false | |
if(Test-Path $dst -PathType Container) { | |
$dst_changed = $true | |
$dst = Join-Path $dst $_.Value.src_basename | |
} | |
New-Object psobject -Property @{ | |
chk_exists = ($exists = Test-Path $dst -PathType Leaf) | |
src_md5 = ($sMd5 = $_.Key) | |
dst_md5 = ($dMd5 = if ($exists) { Get-MD5Sum $dst } else { $null }) | |
chk_dirty = ($dirty = if ($sMd5 -ne $dMd5) { $true } else { $false }) | |
verifies = if ($dirty -eq $false) { $true } else { $false } | |
target_is_folder = $dst_changed | |
} | |
} | Select-Object -Property chk_exists,src_md5,dst_md5,chk_dirty,verifies,target_is_folder | |
} | |
Function Get-MD5Sum($src) { | |
Try { | |
$c = [System.Security.Cryptography.MD5]::Create() | |
$bytes = $c.ComputeHash(($in = (Get-Item $src).OpenRead())) | |
return ([System.BitConverter]::ToString($bytes)).Replace("-", "").ToLower() | |
} | |
Finally { | |
Cleanup $c | |
Cleanup $in | |
} | |
} | |
Function Unresolve-Path($path) { | |
if ($path -eq $null) { | |
return $null | |
} | |
else { | |
return $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($path) | |
} | |
} | |
Check-Files $hash_file | ConvertTo-Csv -NoTypeInformation | |
if (!$?) { if($LASTEXITCODE) { exit $LASTEXITCODE } else { exit 1 } } with id: 79F2E53E-B354-453A-8E4E-BFCF3BE9AEB0 | |
D [WinRM] creating command_id: 79F2E53E-B354-453A-8E4E-BFCF3BE9AEB0 on shell_id 9221BECA-B4A4-441C-B94D-F537466FCB65 | |
D [WinRM] Waiting for output... | |
D [WinRM] Processing output | |
D [WinRM] cleaning up command_id: 79F2E53E-B354-453A-8E4E-BFCF3BE9AEB0 on shell_id 9221BECA-B4A4-441C-B94D-F537466FCB65 | |
D Parsing CSV Response | |
D "chk_exists","src_md5","dst_md5","chk_dirty","verifies","target_is_folder" | |
"False","004bc4f2a1c46004537879ada398ea86",,"True","False","False" | |
D Uploading C:/Users/JOSEPH~1.BOL/AppData/Local/Temp/winrm-elevated-shell20170410-10048-fzsu46ps1 to c:/windows/temp/winrm-elevated-shell-9f77bde7-c94f-499d-9e36-b48dded9dafb.ps1 | |
D [WinRM] Command created for $to = $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath("c:/windows/temp/winrm-elevated-shell-9f77bde7-c94f-499d-9e36-b48dded9dafb.ps1") | |
$parent = Split-Path $to | |
if(!(Test-path $parent)) { mkdir $parent | Out-Null } | |
$fileStream = New-Object -TypeName System.IO.FileStream -ArgumentList @( | |
$to, | |
[system.io.filemode]::Create, | |
[System.io.FileAccess]::Write, | |
[System.IO.FileShare]::ReadWrite | |
) | |
# Powershell caches ScrpitBlocks in a dictionary | |
# keyed on the script block text. Thats just great | |
# unless the script is super large and called a gillion | |
# times like we might do. In such a case it will saturate the | |
# Large Object Heap and lead to Out Of Memory exceptions | |
# for large files or folders. So we call the internal method | |
# ClearScriptBlockCache to clear it. | |
$bindingFlags= [Reflection.BindingFlags] "NonPublic,Static" | |
$method = [scriptblock].GetMethod("ClearScriptBlockCache", $bindingFlags) | |
if (!$?) { if($LASTEXITCODE) { exit $LASTEXITCODE } else { exit 1 } } with id: 9799365B-520C-4454-9050-92EF4484CCA3 | |
D [WinRM] creating command_id: 9799365B-520C-4454-9050-92EF4484CCA3 on shell_id 9221BECA-B4A4-441C-B94D-F537466FCB65 | |
D [WinRM] Waiting for output... | |
D [WinRM] Processing output | |
D [WinRM] cleaning up command_id: 9799365B-520C-4454-9050-92EF4484CCA3 on shell_id 9221BECA-B4A4-441C-B94D-F537466FCB65 | |
D [WinRM] Command created for if($method) { $method.Invoke($Null, $Null) } | |
$bytes=[Convert]::FromBase64String('JGVudjp0ZW1wPSdDOlxVc2Vyc1xBRE1JTkl+MVxBcHBEYXRhXExvY2FsXFRlbXAnOyRlbnY6VEVTVF9LSVRDSEVOID0gIjEiDQokZGlycyA9IEAoIiRlbnY6VEVNUFxraXRjaGVuXGNsaWVudHMiLCAiJGVudjpURU1QXGtpdGNoZW5cY29va2Jvb2tzIiwgIiRlbnY6VEVNUFxraXRjaGVuXGRhdGE | |
iLCAiJGVudjpURU1QXGtpdGNoZW5cZGF0YV9iYWdzIiwgIiRlbnY6VEVNUFxraXRjaGVuXGVuY3J5cHRlZF9kYXRhX2JhZ19zZWNyZXQiLCAiJGVudjpURU1QXGtpdGNoZW5cZW52aXJvbm1lbnRzIiwgIiRlbnY6VEVNUFxraXRjaGVuXHJvbGVzIikNCiRyb290X3BhdGggPSAiJGVudjpURU1QXGtpdGNoZW4iDQoNCkZ1bmN0aW9uIERlbGV0ZS1BbGxEaXJzKC | |
RkaXJzKSB7DQogICRkaXJzIHwgRm9yRWFjaC1PYmplY3Qgew0KICAgIGlmIChUZXN0LVBhdGggKCRwYXRoID0gVW5yZXNvbHZlLVBhdGggJF8pKSB7IFJlbW92ZS1JdGVtICRwYXRoIC1SZWN1cnNlIC1Gb3JjZSB9DQogIH0NCn0NCg0KRnVuY3Rpb24gVW5yZXNvbHZlLVBhdGgoJHApIHsNCiAgaWYgKCRwIC1lcSAkbnVsbCkgeyByZXR1cm4gJG51bGwgfQ0KI | |
CBlbHNlIHsgcmV0dXJuICRFeGVjdXRpb25Db250ZXh0LlNlc3Npb25TdGF0ZS5QYXRoLkdldFVucmVzb2x2ZWRQcm92aWRlclBhdGhGcm9tUFNQYXRoKCRwKSB9DQp9DQoNCkZ1bmN0aW9uIE1ha2UtUm9vdFBhdGgoJHApIHsNCiAgJHAgPSBVbnJlc29sdmUtUGF0aCAkcA0KICBpZiAoLU5vdCAoVGVzdC1QYXRoICRwKSkgeyBOZXctSXRlbSAkcCAtSXRlbVR5 | |
cGUgZGlyZWN0b3J5IHwgT3V0LU51bGwgfQ0KfQ0KDQpEZWxldGUtQWxsRGlycyAkZGlycw0KTWFrZS1Sb290UGF0aCAkcm9vdF9wYXRoDQoNDQokSG9zdC5TZXRTaG91bGRFeGl0KCRMQVNURVhJVENPREUp') | |
$fileStream.Write($bytes, 0, $bytes.length) | |
if (!$?) { if($LASTEXITCODE) { exit $LASTEXITCODE } else { exit 1 } } with id: E94C3F51-0104-4713-B365-C6925875EDA1 | |
D [WinRM] creating command_id: E94C3F51-0104-4713-B365-C6925875EDA1 on shell_id 9221BECA-B4A4-441C-B94D-F537466FCB65 | |
D [WinRM] Waiting for output... | |
D [WinRM] Processing output | |
D [WinRM] cleaning up command_id: E94C3F51-0104-4713-B365-C6925875EDA1 on shell_id 9221BECA-B4A4-441C-B94D-F537466FCB65 | |
D [WinRM] Command created for $fileStream.Dispose() | |
if (!$?) { if($LASTEXITCODE) { exit $LASTEXITCODE } else { exit 1 } } with id: 4392706B-63ED-44E7-9B19-3D294C0DE448 | |
D [WinRM] creating command_id: 4392706B-63ED-44E7-9B19-3D294C0DE448 on shell_id 9221BECA-B4A4-441C-B94D-F537466FCB65 | |
D [WinRM] Waiting for output... | |
D [WinRM] Processing output | |
D [WinRM] cleaning up command_id: 4392706B-63ED-44E7-9B19-3D294C0DE448 on shell_id 9221BECA-B4A4-441C-B94D-F537466FCB65 | |
D Finished uploading C:/Users/JOSEPH~1.BOL/AppData/Local/Temp/winrm-elevated-shell20170410-10048-fzsu46ps1 to c:/windows/temp/winrm-elevated-shell-9f77bde7-c94f-499d-9e36-b48dded9dafb.ps1 (1.192 KB over 1 chunks) in (0m0.28s) | |
D No remote files to extract, skipping | |
D Uploaded 1 items dirty_check: (0m0.13s) stream_files: (0m0.28s) extract: (0m0.00s) | |
D [WinRM] Command created for $username = 'Administrator' | |
$password = 'vagrant' | |
$script_file = 'c:/windows/temp/winrm-elevated-shell-9f77bde7-c94f-499d-9e36-b48dded9dafb.ps1' | |
$interactive = 'false' | |
$pass_to_use = $password | |
$logon_type = 1 | |
$logon_type_xml = "<LogonType>Password</LogonType>" | |
if($pass_to_use.length -eq 0) { | |
$pass_to_use = $null | |
$logon_type = 5 | |
$logon_type_xml = "" | |
} | |
if($interactive -eq 'true') { | |
$logon_type = 3 | |
$logon_type_xml = "<LogonType>InteractiveTokenOrPassword</LogonType>" | |
} | |
$task_name = "WinRM_Elevated_Shell" | |
$out_file = [System.IO.Path]::GetTempFileName() | |
$err_file = [System.IO.Path]::GetTempFileName() | |
$task_xml = @' | |
<?xml version="1.0" encoding="UTF-16"?> | |
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task"> | |
<Principals> | |
<Principal id="Author"> | |
<UserId>{username}</UserId> | |
{logon_type} | |
<RunLevel>HighestAvailable</RunLevel> | |
</Principal> | |
</Principals> | |
<Settings> | |
<MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy> | |
<DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries> | |
<StopIfGoingOnBatteries>false</StopIfGoingOnBatteries> | |
<AllowHardTerminate>true</AllowHardTerminate> | |
<StartWhenAvailable>false</StartWhenAvailable> | |
<RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable> | |
<IdleSettings> | |
<StopOnIdleEnd>false</StopOnIdleEnd> | |
<RestartOnIdle>false</RestartOnIdle> | |
</IdleSettings> | |
<AllowStartOnDemand>true</AllowStartOnDemand> | |
<Enabled>true</Enabled> | |
<Hidden>false</Hidden> | |
<RunOnlyIfIdle>false</RunOnlyIfIdle> | |
<WakeToRun>false</WakeToRun> | |
<ExecutionTimeLimit>PT24H</ExecutionTimeLimit> | |
<Priority>4</Priority> | |
</Settings> | |
<Actions Context="Author"> | |
<Exec> | |
<Command>cmd</Command> | |
<Arguments>{arguments}</Arguments> | |
</Exec> | |
</Actions> | |
</Task> | |
'@ | |
$arguments = "/c powershell.exe -executionpolicy bypass -NoProfile -File $script_file > $out_file 2>$err_file" | |
$task_xml = $task_xml.Replace("{arguments}", $arguments) | |
$task_xml = $task_xml.Replace("{username}", $username) | |
$task_xml = $task_xml.Replace("{logon_type}", $logon_type_xml) | |
$schedule = New-Object -ComObject "Schedule.Service" | |
$schedule.Connect() | |
$task = $schedule.NewTask($null) | |
$task.XmlText = $task_xml | |
$folder = $schedule.GetFolder("\") | |
$folder.RegisterTaskDefinition($task_name, $task, 6, $username, $pass_to_use, $logon_type, $null) | Out-Null | |
$registered_task = $folder.GetTask("\$task_name") | |
$registered_task.Run($null) | Out-Null | |
$timeout = 10 | |
$sec = 0 | |
while ( (!($registered_task.state -eq 4)) -and ($sec -lt $timeout) ) { | |
Start-Sleep -s 1 | |
$sec++ | |
} | |
function SlurpOutput($file, $cur_line, $out_type) { | |
if (Test-Path $file) { | |
get-content $file | select -skip $cur_line | ForEach { | |
$cur_line += 1 | |
if ($out_type -eq 'err') { | |
$host.ui.WriteErrorLine("$_") | |
} else { | |
$host.ui.WriteLine("$_") | |
} | |
} | |
} | |
return $cur_line | |
} | |
$err_cur_line = 0 | |
$out_cur_line = 0 | |
do { | |
Start-Sleep -m 100 | |
$out_cur_line = SlurpOutput $out_file $out_cur_line 'out' | |
$err_cur_line = SlurpOutput $err_file $err_cur_line 'err' | |
} while (!($registered_task.state -eq 3)) | |
# We'll make a best effort to clean these files | |
# But a reboot could possibly end the task while the process | |
# still runs and locks the file. If we can't delete we don't want to fail | |
try { Remove-Item $out_file -ErrorAction Stop } catch {} | |
try { Remove-Item $err_file -ErrorAction Stop } catch {} | |
try { Remove-Item $script_file -ErrorAction Stop } catch {} | |
$exit_code = $registered_task.LastTaskResult | |
[System.Runtime.Interopservices.Marshal]::ReleaseComObject($schedule) | Out-Null | |
exit $exit_code | |
if (!$?) { if($LASTEXITCODE) { exit $LASTEXITCODE } else { exit 1 } } with id: B3CA94D8-E8BC-48A3-A77D-603E851C4C0A | |
D [WinRM] creating command_id: B3CA94D8-E8BC-48A3-A77D-603E851C4C0A on shell_id 9221BECA-B4A4-441C-B94D-F537466FCB65 | |
D [WinRM] Waiting for output... | |
D [WinRM] Processing output | |
D [WinRM] cleaning up command_id: B3CA94D8-E8BC-48A3-A77D-603E851C4C0A on shell_id 9221BECA-B4A4-441C-B94D-F537466FCB65 | |
Transferring files to <default-windows-2012r2> | |
D creating hash for directory $env:TEMP\kitchen | |
D Populating files | |
D === All files added. | |
D creating hash for file $env:TEMP\kitchen | |
D creating hash for directory $env:TEMP\kitchen | |
D Populating files | |
D +++ Adding chocolatey/README.md | |
D +++ Adding chocolatey/attributes/default.rb | |
D +++ Adding chocolatey/files/install.ps1 | |
D +++ Adding chocolatey/libraries/helpers.rb | |
D +++ Adding chocolatey/libraries/matchers.rb | |
D +++ Adding chocolatey/metadata.json | |
D +++ Adding chocolatey/providers/default.rb | |
D +++ Adding chocolatey/recipes/default.rb | |
D +++ Adding chocolatey/resources/default.rb | |
D +++ Adding dd-windows/README.md | |
D +++ Adding dd-windows/attributes/default.rb | |
D +++ Adding dd-windows/files/artifacts.ps1 | |
D +++ Adding dd-windows/files/encpass.txt | |
D +++ Adding dd-windows/files/user.txt | |
D +++ Adding dd-windows/metadata.json | |
D +++ Adding dd-windows/recipes/POSH.rb | |
D +++ Adding dd-windows/recipes/base.rb | |
D +++ Adding dd-windows/recipes/default.rb | |
D +++ Adding ohai/README.md | |
D +++ Adding ohai/libraries/matchers.rb | |
D +++ Adding ohai/metadata.json | |
D +++ Adding ohai/recipes/default.rb | |
D +++ Adding ohai/resources/hint.rb | |
D +++ Adding ohai/resources/plugin.rb | |
D +++ Adding windows/README.md | |
D +++ Adding windows/attributes/default.rb | |
D +++ Adding windows/files/dism_features.rb | |
D +++ Adding windows/libraries/matchers.rb | |
D +++ Adding windows/libraries/powershell_helper.rb | |
D +++ Adding windows/libraries/registry_helper.rb | |
D +++ Adding windows/libraries/version.rb | |
D +++ Adding windows/libraries/version_helper.rb | |
D +++ Adding windows/libraries/windows_helper.rb | |
D +++ Adding windows/libraries/windows_privileged.rb | |
D +++ Adding windows/libraries/wmi_helper.rb | |
D +++ Adding windows/metadata.json | |
D +++ Adding windows/recipes/default.rb | |
D +++ Adding windows/resources/auto_run.rb | |
D +++ Adding windows/resources/certificate.rb | |
D +++ Adding windows/resources/certificate_binding.rb | |
D +++ Adding windows/resources/feature.rb | |
D +++ Adding windows/resources/feature_dism.rb | |
D +++ Adding windows/resources/feature_powershell.rb | |
D +++ Adding windows/resources/feature_servermanagercmd.rb | |
D +++ Adding windows/resources/font.rb | |
D +++ Adding windows/resources/http_acl.rb | |
D +++ Adding windows/resources/pagefile.rb | |
D +++ Adding windows/resources/path.rb | |
D +++ Adding windows/resources/printer.rb | |
D +++ Adding windows/resources/printer_port.rb | |
D +++ Adding windows/resources/share.rb | |
D +++ Adding windows/resources/shortcut.rb | |
D +++ Adding windows/resources/task.rb | |
D +++ Adding windows/resources/zipfile.rb | |
D === All files added. | |
D creating hash for file $env:TEMP\kitchen | |
D creating hash for file $env:TEMP\kitchen | |
D Running check_files.ps1 | |
D [WinRM] Command created for $hash_file = @{ | |
"76cdb2bad9582d23c1f6f4d868218d6c" = @{ | |
"target" = "$env:TEMP\winrm-upload\tmpzip-76cdb2bad9582d23c1f6f4d868218d6c.zip"; | |
"src_basename" = "cache"; | |
"dst" = "$env:TEMP\kitchen\cache" | |
}; | |
"f8b6ec04c0031d104e8f137fc43b3855" = @{ | |
"target" = "$env:TEMP\kitchen"; | |
"src_basename" = "client.rb"; | |
"dst" = "$env:TEMP\kitchen" | |
}; | |
"8cb3505e4aad0d8cc072fc6d210df858" = @{ | |
"target" = "$env:TEMP\winrm-upload\tmpzip-8cb3505e4aad0d8cc072fc6d210df858.zip"; | |
"src_basename" = "cookbooks"; | |
"dst" = "$env:TEMP\kitchen\cookbooks" | |
}; | |
"51e59f385726e026a21059e22dbfadf2" = @{ | |
"target" = "$env:TEMP\kitchen"; | |
"src_basename" = "dna.json"; | |
"dst" = "$env:TEMP\kitchen" | |
}; | |
"49abb94825cb80b9a9cd59e5f76daf4a" = @{ | |
"target" = "$env:TEMP\kitchen"; | |
"src_basename" = "validation.pem"; | |
"dst" = "$env:TEMP\kitchen" | |
} | |
} | |
Function Cleanup($disposable) { | |
if (($disposable -ne $null) -and ($disposable.GetType().GetMethod("Dispose") -ne $null)) { | |
$disposable.Dispose() | |
} | |
} | |
Function Check-Files($h) { | |
return $h.GetEnumerator() | ForEach-Object { | |
$dst = Unresolve-Path $_.Value.target | |
$dst_changed = $false | |
if(Test-Path $dst -PathType Container) { | |
$dst_changed = $true | |
$dst = Join-Path $dst $_.Value.src_basename | |
} | |
New-Object psobject -Property @{ | |
chk_exists = ($exists = Test-Path $dst -PathType Leaf) | |
src_md5 = ($sMd5 = $_.Key) | |
dst_md5 = ($dMd5 = if ($exists) { Get-MD5Sum $dst } else { $null }) | |
chk_dirty = ($dirty = if ($sMd5 -ne $dMd5) { $true } else { $false }) | |
verifies = if ($dirty -eq $false) { $true } else { $false } | |
target_is_folder = $dst_changed | |
} | |
} | Select-Object -Property chk_exists,src_md5,dst_md5,chk_dirty,verifies,target_is_folder | |
} | |
Function Get-MD5Sum($src) { | |
Try { | |
$c = [System.Security.Cryptography.MD5]::Create() | |
$bytes = $c.ComputeHash(($in = (Get-Item $src).OpenRead())) | |
return ([System.BitConverter]::ToString($bytes)).Replace("-", "").ToLower() | |
} | |
Finally { | |
Cleanup $c | |
Cleanup $in | |
} | |
} | |
Function Unresolve-Path($path) { | |
if ($path -eq $null) { | |
return $null | |
} | |
else { | |
return $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($path) | |
} | |
} | |
Check-Files $hash_file | ConvertTo-Csv -NoTypeInformation | |
if (!$?) { if($LASTEXITCODE) { exit $LASTEXITCODE } else { exit 1 } } with id: D2F8B8C3-8967-4993-9E6A-C9AA04020100 | |
D [WinRM] creating command_id: D2F8B8C3-8967-4993-9E6A-C9AA04020100 on shell_id 223870FC-6D72-4B6B-9A9C-60476057A297 | |
D [WinRM] Waiting for output... | |
D [WinRM] Processing output | |
D [WinRM] cleaning up command_id: D2F8B8C3-8967-4993-9E6A-C9AA04020100 on shell_id 223870FC-6D72-4B6B-9A9C-60476057A297 | |
D Parsing CSV Response | |
D "chk_exists","src_md5","dst_md5","chk_dirty","verifies","target_is_folder" | |
"True","51e59f385726e026a21059e22dbfadf2","51e59f385726e026a21059e22dbfadf2","False","True","True" | |
"True","f8b6ec04c0031d104e8f137fc43b3855","f8b6ec04c0031d104e8f137fc43b3855","False","True","True" | |
"True","76cdb2bad9582d23c1f6f4d868218d6c","76cdb2bad9582d23c1f6f4d868218d6c","False","True","False" | |
"True","49abb94825cb80b9a9cd59e5f76daf4a","49abb94825cb80b9a9cd59e5f76daf4a","False","True","True" | |
"True","8cb3505e4aad0d8cc072fc6d210df858","8cb3505e4aad0d8cc072fc6d210df858","False","True","False" | |
D File $env:TEMP\kitchen\cache is up to date, skipping | |
D File $env:TEMP\kitchen/client.rb is up to date, skipping | |
D File $env:TEMP\kitchen\cookbooks is up to date, skipping | |
D File $env:TEMP\kitchen/dna.json is up to date, skipping | |
D File $env:TEMP\kitchen/validation.pem is up to date, skipping | |
D Running extract_files.ps1 | |
D [WinRM] Command created for trap { | |
$e = $_.Exception | |
$e.InvocationInfo.ScriptName | |
do { | |
$e.Message | |
$e = $e.InnerException | |
} while ($e) | |
break | |
} | |
function folder($path){ | |
$path | ? {-not (test-path $_)} | % {$null = mkdir $_} | |
} | |
Function Decode-Files($hash) { | |
foreach ($key in $hash.keys) { | |
$value = $hash[$key] | |
$tzip, $dst = $Value["tmpzip"], $Value["dst"] | |
if ($tzip) {Unzip-File $tzip $dst} | |
New-Object psobject -Property @{dst=$dst;src_md5=$key;tmpzip=$tzip} | |
} | |
} | |
Function Unzip-File($src, $dst) { | |
$unpack = $src -replace '\.zip' | |
$dst_parent = Split-Path -Path $dst -Parent | |
if(!(Test-Path $dst_parent)) { $dst = $dst_parent } | |
folder $unpack, $dst | |
try { | |
try{ | |
[IO.Compression.ZipFile]::ExtractToDirectory($src, $unpack) | |
} | |
catch { | |
Add-Type -AssemblyName System.IO.Compression.FileSystem -ErrorAction Stop | |
[IO.Compression.ZipFile]::ExtractToDirectory($src, $unpack) | |
} | |
} | |
catch { | |
Try { | |
$s = New-Object -ComObject Shell.Application | |
($s.NameSpace($unpack)).CopyHere(($s.NameSpace($src)).Items(), 0x610) | |
} | |
Finally { | |
[void][Runtime.Interopservices.Marshal]::ReleaseComObject($s) | |
} | |
} | |
dir $unpack | cp -dest "$dst/" -force -recurse | |
rm $unpack -recurse -force | |
} | |
$hash_file = @{ | |
"76cdb2bad9582d23c1f6f4d868218d6c" = @{ | |
"dst" = "$env:TEMP\kitchen\cache"; | |
"tmpzip" = "$env:TEMP\winrm-upload\tmpzip-76cdb2bad9582d23c1f6f4d868218d6c.zip" | |
}; | |
"8cb3505e4aad0d8cc072fc6d210df858" = @{ | |
"dst" = "$env:TEMP\kitchen\cookbooks"; | |
"tmpzip" = "$env:TEMP\winrm-upload\tmpzip-8cb3505e4aad0d8cc072fc6d210df858.zip" | |
} | |
} | |
Decode-Files $hash_file | ConvertTo-Csv -NoTypeInformation | |
if (!$?) { if($LASTEXITCODE) { exit $LASTEXITCODE } else { exit 1 } } with id: 34AB6777-FA21-42C1-8854-B321D2DDD661 | |
D [WinRM] creating command_id: 34AB6777-FA21-42C1-8854-B321D2DDD661 on shell_id 223870FC-6D72-4B6B-9A9C-60476057A297 | |
D [WinRM] Waiting for output... | |
D [WinRM] Processing output | |
D [WinRM] cleaning up command_id: 34AB6777-FA21-42C1-8854-B321D2DDD661 on shell_id 223870FC-6D72-4B6B-9A9C-60476057A297 | |
D Parsing CSV Response | |
D "src_md5","tmpzip","dst" | |
"76cdb2bad9582d23c1f6f4d868218d6c","C:\Users\ADMINI~1\AppData\Local\Temp\winrm-upload\tmpzip-76cdb2bad9582d23c1f6f4d868218d6c.zip","C:\Users\ADMINI~1\AppData\Local\Temp\kitchen\cache" | |
"8cb3505e4aad0d8cc072fc6d210df858","C:\Users\ADMINI~1\AppData\Local\Temp\winrm-upload\tmpzip-8cb3505e4aad0d8cc072fc6d210df858.zip","C:\Users\ADMINI~1\AppData\Local\Temp\kitchen\cookbooks" | |
D Cleaned up src_zip C:/Users/JOSEPH~1.BOL/AppData/Local/Temp/tmpzip-20170410-10048-1op866h.zip | |
D Cleaned up src_zip C:/Users/JOSEPH~1.BOL/AppData/Local/Temp/tmpzip-20170410-10048-1ieeqm4.zip | |
D Uploaded 5 items dirty_check: (0m0.49s) stream_files: (0m0.00s) extract: (0m0.30s) | |
D Transfer complete | |
D Attempting to execute command - try 1 of 1. | |
D [WinRM] <{:endpoint=>"http://127.0.0.1:2200/wsman", :user=>"Administrator", :password=>"vagrant", :transport=>:negotiate, :elevated_username=>"Administrator", :elevated_password=>"vagrant", :no_ssl_peer_verification=>true, :disable_sspi=>false, :basic_auth_only=>f | |
alse}> ($env:TEST_KITCHEN = "1" | |
$env:PATH = try { | |
[System.Environment]::GetEnvironmentVariable('PATH','Machine') | |
} catch { $env:PATH } | |
& $env:systemdrive\opscode\chef\bin\chef-client.bat --local-mode --config $env:TEMP\kitchen\client.rb --log_level auto --force-formatter --no-color --json-attributes $env:TEMP\kitchen\dna.json --chef-zero-port 8889 ; exit $LastExitCode) | |
D creating hash for file c:/windows/temp/winrm-elevated-shell-c193fa23-4a43-422e-89ec-6c2e36222a5c.ps1 | |
D Running check_files.ps1 | |
D [WinRM] Command created for $hash_file = @{ | |
"ef38ff2ec28c936eac80b878ab63a915" = @{ | |
"target" = "c:/windows/temp/winrm-elevated-shell-c193fa23-4a43-422e-89ec-6c2e36222a5c.ps1"; | |
"src_basename" = "winrm-elevated-shell20170410-10048-1tmc7lxps1"; | |
"dst" = "c:/windows/temp/winrm-elevated-shell-c193fa23-4a43-422e-89ec-6c2e36222a5c.ps1" | |
} | |
} | |
Function Cleanup($disposable) { | |
if (($disposable -ne $null) -and ($disposable.GetType().GetMethod("Dispose") -ne $null)) { | |
$disposable.Dispose() | |
} | |
} | |
Function Check-Files($h) { | |
return $h.GetEnumerator() | ForEach-Object { | |
$dst = Unresolve-Path $_.Value.target | |
$dst_changed = $false | |
if(Test-Path $dst -PathType Container) { | |
$dst_changed = $true | |
$dst = Join-Path $dst $_.Value.src_basename | |
} | |
New-Object psobject -Property @{ | |
chk_exists = ($exists = Test-Path $dst -PathType Leaf) | |
src_md5 = ($sMd5 = $_.Key) | |
dst_md5 = ($dMd5 = if ($exists) { Get-MD5Sum $dst } else { $null }) | |
chk_dirty = ($dirty = if ($sMd5 -ne $dMd5) { $true } else { $false }) | |
verifies = if ($dirty -eq $false) { $true } else { $false } | |
target_is_folder = $dst_changed | |
} | |
} | Select-Object -Property chk_exists,src_md5,dst_md5,chk_dirty,verifies,target_is_folder | |
} | |
Function Get-MD5Sum($src) { | |
Try { | |
$c = [System.Security.Cryptography.MD5]::Create() | |
$bytes = $c.ComputeHash(($in = (Get-Item $src).OpenRead())) | |
return ([System.BitConverter]::ToString($bytes)).Replace("-", "").ToLower() | |
} | |
Finally { | |
Cleanup $c | |
Cleanup $in | |
} | |
} | |
Function Unresolve-Path($path) { | |
if ($path -eq $null) { | |
return $null | |
} | |
else { | |
return $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($path) | |
} | |
} | |
Check-Files $hash_file | ConvertTo-Csv -NoTypeInformation | |
if (!$?) { if($LASTEXITCODE) { exit $LASTEXITCODE } else { exit 1 } } with id: 118065FE-F9A8-4750-B7D2-37D41869FF7F | |
D [WinRM] creating command_id: 118065FE-F9A8-4750-B7D2-37D41869FF7F on shell_id 9221BECA-B4A4-441C-B94D-F537466FCB65 | |
D [WinRM] Waiting for output... | |
D [WinRM] Processing output | |
D [WinRM] cleaning up command_id: 118065FE-F9A8-4750-B7D2-37D41869FF7F on shell_id 9221BECA-B4A4-441C-B94D-F537466FCB65 | |
D Parsing CSV Response | |
D "chk_exists","src_md5","dst_md5","chk_dirty","verifies","target_is_folder" | |
"False","ef38ff2ec28c936eac80b878ab63a915",,"True","False","False" | |
D Uploading C:/Users/JOSEPH~1.BOL/AppData/Local/Temp/winrm-elevated-shell20170410-10048-1tmc7lxps1 to c:/windows/temp/winrm-elevated-shell-c193fa23-4a43-422e-89ec-6c2e36222a5c.ps1 | |
D [WinRM] Command created for $to = $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath("c:/windows/temp/winrm-elevated-shell-c193fa23-4a43-422e-89ec-6c2e36222a5c.ps1") | |
$parent = Split-Path $to | |
if(!(Test-path $parent)) { mkdir $parent | Out-Null } | |
$fileStream = New-Object -TypeName System.IO.FileStream -ArgumentList @( | |
$to, | |
[system.io.filemode]::Create, | |
[System.io.FileAccess]::Write, | |
[System.IO.FileShare]::ReadWrite | |
) | |
# Powershell caches ScrpitBlocks in a dictionary | |
# keyed on the script block text. Thats just great | |
# unless the script is super large and called a gillion | |
# times like we might do. In such a case it will saturate the | |
# Large Object Heap and lead to Out Of Memory exceptions | |
# for large files or folders. So we call the internal method | |
# ClearScriptBlockCache to clear it. | |
$bindingFlags= [Reflection.BindingFlags] "NonPublic,Static" | |
$method = [scriptblock].GetMethod("ClearScriptBlockCache", $bindingFlags) | |
if (!$?) { if($LASTEXITCODE) { exit $LASTEXITCODE } else { exit 1 } } with id: 16BB6C21-CF19-4900-B051-17A6D60CBB43 | |
D [WinRM] creating command_id: 16BB6C21-CF19-4900-B051-17A6D60CBB43 on shell_id 9221BECA-B4A4-441C-B94D-F537466FCB65 | |
D [WinRM] Waiting for output... | |
D [WinRM] Processing output | |
D [WinRM] cleaning up command_id: 16BB6C21-CF19-4900-B051-17A6D60CBB43 on shell_id 9221BECA-B4A4-441C-B94D-F537466FCB65 | |
D [WinRM] Command created for if($method) { $method.Invoke($Null, $Null) } | |
$bytes=[Convert]::FromBase64String('JGVudjp0ZW1wPSdDOlxVc2Vyc1xBRE1JTkl+MVxBcHBEYXRhXExvY2FsXFRlbXAnOyRlbnY6VEVTVF9LSVRDSEVOID0gIjEiDQokZW52OlBBVEggPSB0cnkgew0KW1N5c3RlbS5FbnZpcm9ubWVudF06OkdldEVudmlyb25tZW50VmFyaWFibGUoJ1BBVEgnLCdNYWNoaW5lJykNCn0gY2F0Y2ggeyA | |
kZW52OlBBVEggfQ0KDQomICRlbnY6c3lzdGVtZHJpdmVcb3BzY29kZVxjaGVmXGJpblxjaGVmLWNsaWVudC5iYXQgLS1sb2NhbC1tb2RlIC0tY29uZmlnICRlbnY6VEVNUFxraXRjaGVuXGNsaWVudC5yYiAtLWxvZ19sZXZlbCBhdXRvIC0tZm9yY2UtZm9ybWF0dGVyIC0tbm8tY29sb3IgLS1qc29uLWF0dHJpYnV0ZXMgJGVudjpURU1QXGtpdGNoZW5cZG5hLm | |
pzb24gLS1jaGVmLXplcm8tcG9ydCA4ODg5IDsgZXhpdCAkTGFzdEV4aXRDb2RlDQ0KJEhvc3QuU2V0U2hvdWxkRXhpdCgkTEFTVEVYSVRDT0RFKQ==') | |
$fileStream.Write($bytes, 0, $bytes.length) | |
if (!$?) { if($LASTEXITCODE) { exit $LASTEXITCODE } else { exit 1 } } with id: B5C197A5-0B1D-4996-A1D1-C6E7884AD00E | |
D [WinRM] creating command_id: B5C197A5-0B1D-4996-A1D1-C6E7884AD00E on shell_id 9221BECA-B4A4-441C-B94D-F537466FCB65 | |
D [WinRM] Waiting for output... | |
D [WinRM] Processing output | |
D [WinRM] cleaning up command_id: B5C197A5-0B1D-4996-A1D1-C6E7884AD00E on shell_id 9221BECA-B4A4-441C-B94D-F537466FCB65 | |
D [WinRM] Command created for $fileStream.Dispose() | |
if (!$?) { if($LASTEXITCODE) { exit $LASTEXITCODE } else { exit 1 } } with id: C5E95A9B-528D-4C7D-B393-8AEA5739D07F | |
D [WinRM] creating command_id: C5E95A9B-528D-4C7D-B393-8AEA5739D07F on shell_id 9221BECA-B4A4-441C-B94D-F537466FCB65 | |
D [WinRM] Waiting for output... | |
D [WinRM] Processing output | |
D [WinRM] cleaning up command_id: C5E95A9B-528D-4C7D-B393-8AEA5739D07F on shell_id 9221BECA-B4A4-441C-B94D-F537466FCB65 | |
D Finished uploading C:/Users/JOSEPH~1.BOL/AppData/Local/Temp/winrm-elevated-shell20170410-10048-1tmc7lxps1 to c:/windows/temp/winrm-elevated-shell-c193fa23-4a43-422e-89ec-6c2e36222a5c.ps1 (0.604 KB over 1 chunks) in (0m0.30s) | |
D No remote files to extract, skipping | |
D Uploaded 1 items dirty_check: (0m0.13s) stream_files: (0m0.31s) extract: (0m0.00s) | |
D [WinRM] Command created for $username = 'Administrator' | |
$password = 'vagrant' | |
$script_file = 'c:/windows/temp/winrm-elevated-shell-c193fa23-4a43-422e-89ec-6c2e36222a5c.ps1' | |
$interactive = 'false' | |
$pass_to_use = $password | |
$logon_type = 1 | |
$logon_type_xml = "<LogonType>Password</LogonType>" | |
if($pass_to_use.length -eq 0) { | |
$pass_to_use = $null | |
$logon_type = 5 | |
$logon_type_xml = "" | |
} | |
if($interactive -eq 'true') { | |
$logon_type = 3 | |
$logon_type_xml = "<LogonType>InteractiveTokenOrPassword</LogonType>" | |
} | |
$task_name = "WinRM_Elevated_Shell" | |
$out_file = [System.IO.Path]::GetTempFileName() | |
$err_file = [System.IO.Path]::GetTempFileName() | |
$task_xml = @' | |
<?xml version="1.0" encoding="UTF-16"?> | |
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task"> | |
<Principals> | |
<Principal id="Author"> | |
<UserId>{username}</UserId> | |
{logon_type} | |
<RunLevel>HighestAvailable</RunLevel> | |
</Principal> | |
</Principals> | |
<Settings> | |
<MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy> | |
<DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries> | |
<StopIfGoingOnBatteries>false</StopIfGoingOnBatteries> | |
<AllowHardTerminate>true</AllowHardTerminate> | |
<StartWhenAvailable>false</StartWhenAvailable> | |
<RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable> | |
<IdleSettings> | |
<StopOnIdleEnd>false</StopOnIdleEnd> | |
<RestartOnIdle>false</RestartOnIdle> | |
</IdleSettings> | |
<AllowStartOnDemand>true</AllowStartOnDemand> | |
<Enabled>true</Enabled> | |
<Hidden>false</Hidden> | |
<RunOnlyIfIdle>false</RunOnlyIfIdle> | |
<WakeToRun>false</WakeToRun> | |
<ExecutionTimeLimit>PT24H</ExecutionTimeLimit> | |
<Priority>4</Priority> | |
</Settings> | |
<Actions Context="Author"> | |
<Exec> | |
<Command>cmd</Command> | |
<Arguments>{arguments}</Arguments> | |
</Exec> | |
</Actions> | |
</Task> | |
'@ | |
$arguments = "/c powershell.exe -executionpolicy bypass -NoProfile -File $script_file > $out_file 2>$err_file" | |
$task_xml = $task_xml.Replace("{arguments}", $arguments) | |
$task_xml = $task_xml.Replace("{username}", $username) | |
$task_xml = $task_xml.Replace("{logon_type}", $logon_type_xml) | |
$schedule = New-Object -ComObject "Schedule.Service" | |
$schedule.Connect() | |
$task = $schedule.NewTask($null) | |
$task.XmlText = $task_xml | |
$folder = $schedule.GetFolder("\") | |
$folder.RegisterTaskDefinition($task_name, $task, 6, $username, $pass_to_use, $logon_type, $null) | Out-Null | |
$registered_task = $folder.GetTask("\$task_name") | |
$registered_task.Run($null) | Out-Null | |
$timeout = 10 | |
$sec = 0 | |
while ( (!($registered_task.state -eq 4)) -and ($sec -lt $timeout) ) { | |
Start-Sleep -s 1 | |
$sec++ | |
} | |
function SlurpOutput($file, $cur_line, $out_type) { | |
if (Test-Path $file) { | |
get-content $file | select -skip $cur_line | ForEach { | |
$cur_line += 1 | |
if ($out_type -eq 'err') { | |
$host.ui.WriteErrorLine("$_") | |
} else { | |
$host.ui.WriteLine("$_") | |
} | |
} | |
} | |
return $cur_line | |
} | |
$err_cur_line = 0 | |
$out_cur_line = 0 | |
do { | |
Start-Sleep -m 100 | |
$out_cur_line = SlurpOutput $out_file $out_cur_line 'out' | |
$err_cur_line = SlurpOutput $err_file $err_cur_line 'err' | |
} while (!($registered_task.state -eq 3)) | |
# We'll make a best effort to clean these files | |
# But a reboot could possibly end the task while the process | |
# still runs and locks the file. If we can't delete we don't want to fail | |
try { Remove-Item $out_file -ErrorAction Stop } catch {} | |
try { Remove-Item $err_file -ErrorAction Stop } catch {} | |
try { Remove-Item $script_file -ErrorAction Stop } catch {} | |
$exit_code = $registered_task.LastTaskResult | |
[System.Runtime.Interopservices.Marshal]::ReleaseComObject($schedule) | Out-Null | |
exit $exit_code | |
if (!$?) { if($LASTEXITCODE) { exit $LASTEXITCODE } else { exit 1 } } with id: F769C716-994F-41A4-853E-71F606FB4C33 | |
D [WinRM] creating command_id: F769C716-994F-41A4-853E-71F606FB4C33 on shell_id 9221BECA-B4A4-441C-B94D-F537466FCB65 | |
D [WinRM] Waiting for output... | |
D [WinRM] Processing output | |
Starting Chef Client, version 13.0.113 | |
D [WinRM] Waiting for output... | |
D [WinRM] Processing output | |
resolving cookbooks for run list: ["dd-windows::base", "dd-windows::POSH"] | |
Synchronizing Cookbooks: | |
- dd-windows (0.1.0) | |
- chocolatey (1.1.0) | |
- windows (3.0.5) | |
- ohai (5.0.3) | |
Installing Cookbook Gems: | |
Compiling Cookbooks... | |
Converging 14 resources | |
Recipe: chocolatey::default | |
* cookbook_file[C:\Users\ADMINI~1\AppData\Local\Temp\kitchen\cache/chocolatey-install.ps1] action create (up to date) | |
* powershell_script[Install Chocolatey] action run | |
================================================================================ | |
Error executing action `run` on resource 'powershell_script[Install Chocolatey]' | |
================================================================================ | |
ArgumentError | |
------------- | |
wrong number of arguments (given 0, expected 1) | |
Resource Declaration: | |
--------------------- | |
# In C:/Users/ADMINI~1/AppData/Local/Temp/kitchen/cache/cookbooks/chocolatey/recipes/default.rb | |
35: powershell_script 'Install Chocolatey' do | |
36: environment node['chocolatey']['install_vars'] | |
37: cwd Chef::Config['file_cache_path'] | |
38: code install_ps1 | |
39: not_if { chocolatey_installed? && (node['chocolatey']['upgrade'] == false) } | |
40: end | |
Compiled Resource: | |
------------------ | |
# Declared in C:/Users/ADMINI~1/AppData/Local/Temp/kitchen/cache/cookbooks/chocolatey/recipes/default.rb:35:in `from_file' | |
powershell_script("Install Chocolatey") do | |
action [:run] | |
default_guard_interpreter :powershell_script | |
command nil | |
backup 5 | |
cwd "C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\kitchen\\cache" | |
environment {"chocolateyProxyLocation"=>nil, "chocolateyProxyUser"=>nil, "chocolateyProxyPassword"=>nil, "chocolateyVersion"=>nil, "chocolateyDownloadUrl"=>"https://chocolatey.org/api/v2/package/chocolatey", "chocolateyUseWindowsCompression"=>nil} | |
returns 0 | |
user nil | |
interpreter "powershell.exe" | |
declared_type :powershell_script | |
cookbook_name "chocolatey" | |
recipe_name "default" | |
code "C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\kitchen\\cache/chocolatey-install.ps1" | |
domain nil | |
not_if { #code block } | |
end | |
System Info: | |
------------ | |
chef_version=13.0.113 | |
platform=windows | |
platform_version=6.3.9600 | |
ruby=ruby 2.4.1p111 (2017-03-22 revision 58053) [x64-mingw32] | |
program_name=C:/opscode/chef/bin/chef-client | |
executable=C:/opscode/chef/bin/chef-client | |
Running handlers: | |
[2017-04-10T13:55:43-07:00] ERROR: Running exception handlers | |
Running handlers complete | |
[2017-04-10T13:55:43-07:00] ERROR: Exception handlers complete | |
Chef Client failed. 0 resources updated in 04 seconds | |
[2017-04-10T13:55:43-07:00] FATAL: Stacktrace dumped to C:/Users/ADMINI~1/AppData/Local/Temp/kitchen/cache/chef-stacktrace.out | |
[2017-04-10T13:55:43-07:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report | |
[2017-04-10T13:55:43-07:00] FATAL: ArgumentError: powershell_script[Install Chocolatey] (chocolatey::default line 35) had an error: ArgumentError: wrong number of arguments (given 0, expected 1) | |
D [WinRM] cleaning up command_id: F769C716-994F-41A4-853E-71F606FB4C33 on shell_id 9221BECA-B4A4-441C-B94D-F537466FCB65 | |
D Cleaning up local sandbox in C:/Users/JOSEPH~1.BOL/AppData/Local/Temp/default-windows-2012r2-sandbox-20170410-10048-1okw10c | |
>>>>>> ------Exception------- | |
>>>>>> Class: Kitchen::ActionFailed | |
>>>>>> Message: 1 actions failed. | |
>>>>>> Converge failed on instance <default-windows-2012r2>. Please see .kitchen/logs/default-windows-2012r2.log for more details | |
>>>>>> ---------------------- | |
>>>>>> Please see .kitchen/logs/kitchen.log for more details | |
>>>>>> Also try running `kitchen diagnose --all` for configuration | |
D ------Exception------- | |
D Class: Kitchen::ActionFailed | |
D Message: 1 actions failed. | |
>>>>>> Converge failed on instance <default-windows-2012r2>. Please see .kitchen/logs/default-windows-2012r2.log for more details | |
D ---------------------- | |
D ------Backtrace------- | |
D C:/chef/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.15.0/lib/kitchen/command.rb:183:in `report_errors' | |
D C:/chef/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.15.0/lib/kitchen/command.rb:174:in `run_action' | |
D C:/chef/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.15.0/lib/kitchen/command/action.rb:36:in `block in call' | |
D C:/chef/chefdk/embedded/lib/ruby/2.3.0/benchmark.rb:293:in `measure' | |
D C:/chef/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.15.0/lib/kitchen/command/action.rb:34:in `call' | |
D C:/chef/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.15.0/lib/kitchen/cli.rb:53:in `perform' | |
D C:/chef/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.15.0/lib/kitchen/cli.rb:187:in `block (2 levels) in <class:CLI>' | |
D C:/chef/chefdk/embedded/lib/ruby/gems/2.3.0/gems/thor-0.19.1/lib/thor/command.rb:27:in `run' | |
D C:/chef/chefdk/embedded/lib/ruby/gems/2.3.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command' | |
D C:/chef/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.15.0/lib/kitchen/cli.rb:334:in `invoke_task' | |
D C:/chef/chefdk/embedded/lib/ruby/gems/2.3.0/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch' | |
D C:/chef/chefdk/embedded/lib/ruby/gems/2.3.0/gems/thor-0.19.1/lib/thor/base.rb:440:in `start' | |
D C:/chef/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.15.0/bin/kitchen:13:in `block in <top (required)>' | |
D C:/chef/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.15.0/lib/kitchen/errors.rb:171:in `with_friendly_errors' | |
D C:/chef/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.15.0/bin/kitchen:13:in `<top (required)>' | |
D C:/chef/chefdk/bin/kitchen:24:in `load' | |
D C:/chef/chefdk/bin/kitchen:24:in `<main>' | |
D ----End Backtrace----- | |
D -Composite Exception-- | |
D Class: Kitchen::InstanceFailure | |
D Message: Converge failed on instance <default-windows-2012r2>. Please see .kitchen/logs/default-windows-2012r2.log for more details | |
D ---------------------- | |
D ------Backtrace------- | |
D C:/chef/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.15.0/lib/kitchen/provisioner/base.rb:83:in `rescue in call' | |
D C:/chef/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.15.0/lib/kitchen/provisioner/base.rb:86:in `call' | |
D C:/chef/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.15.0/lib/kitchen/instance.rb:384:in `block in converge_action' | |
D C:/chef/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.15.0/lib/kitchen/instance.rb:527:in `synchronize_or_call' | |
D C:/chef/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.15.0/lib/kitchen/instance.rb:489:in `block in action' | |
D C:/chef/chefdk/embedded/lib/ruby/2.3.0/benchmark.rb:293:in `measure' | |
D C:/chef/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.15.0/lib/kitchen/instance.rb:488:in `action' | |
D C:/chef/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.15.0/lib/kitchen/instance.rb:380:in `converge_action' | |
D C:/chef/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.15.0/lib/kitchen/instance.rb:359:in `block in transition_to' | |
D C:/chef/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.15.0/lib/kitchen/instance.rb:358:in `each' | |
D C:/chef/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.15.0/lib/kitchen/instance.rb:358:in `transition_to' | |
D C:/chef/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.15.0/lib/kitchen/instance.rb:135:in `converge' | |
D C:/chef/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.15.0/lib/kitchen/command.rb:197:in `public_send' | |
D C:/chef/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.15.0/lib/kitchen/command.rb:197:in `run_action_in_thread' | |
D C:/chef/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.15.0/lib/kitchen/command.rb:169:in `block (2 levels) in run_action' | |
D C:/chef/chefdk/embedded/lib/ruby/gems/2.3.0/gems/logging-2.1.0/lib/logging/diagnostic_context.rb:450:in `block in create_with_logging_context' | |
D ----End Backtrace----- | |
D ---Nested Exception--- | |
D Class: Kitchen::ActionFailed | |
D Message: WinRM exited (1) for command: [$env:TEST_KITCHEN = "1" | |
$env:PATH = try { | |
[System.Environment]::GetEnvironmentVariable('PATH','Machine') | |
} catch { $env:PATH } | |
& $env:systemdrive\opscode\chef\bin\chef-client.bat --local-mode --config $env:TEMP\kitchen\client.rb --log_level auto --force-formatter --no-color --json-attributes $env:TEMP\kitchen\dna.json --chef-zero-port 8889 ; exit $LastExitCode] | |
D ---------------------- | |
D ------Backtrace------- | |
D C:/chef/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.15.0/lib/kitchen/provisioner/base.rb:83:in `rescue in call' | |
D C:/chef/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.15.0/lib/kitchen/provisioner/base.rb:86:in `call' | |
D C:/chef/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.15.0/lib/kitchen/instance.rb:384:in `block in converge_action' | |
D C:/chef/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.15.0/lib/kitchen/instance.rb:527:in `synchronize_or_call' | |
D C:/chef/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.15.0/lib/kitchen/instance.rb:489:in `block in action' | |
D C:/chef/chefdk/embedded/lib/ruby/2.3.0/benchmark.rb:293:in `measure' | |
D C:/chef/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.15.0/lib/kitchen/instance.rb:488:in `action' | |
D C:/chef/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.15.0/lib/kitchen/instance.rb:380:in `converge_action' | |
D C:/chef/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.15.0/lib/kitchen/instance.rb:359:in `block in transition_to' | |
D C:/chef/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.15.0/lib/kitchen/instance.rb:358:in `each' | |
D C:/chef/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.15.0/lib/kitchen/instance.rb:358:in `transition_to' | |
D C:/chef/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.15.0/lib/kitchen/instance.rb:135:in `converge' | |
D C:/chef/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.15.0/lib/kitchen/command.rb:197:in `public_send' | |
D C:/chef/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.15.0/lib/kitchen/command.rb:197:in `run_action_in_thread' | |
D C:/chef/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.15.0/lib/kitchen/command.rb:169:in `block (2 levels) in run_action' | |
D C:/chef/chefdk/embedded/lib/ruby/gems/2.3.0/gems/logging-2.1.0/lib/logging/diagnostic_context.rb:450:in `block in create_with_logging_context' | |
D ----End Backtrace----- | |
PS C:\users\joseph.bollman\Desktop\LABS\Bollman_scripts\dd-windows> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment