diff --git a/deploy/windows/Read-JobPairTimeSamples.ps1 b/deploy/windows/Read-JobPairTimeSamples.ps1 index d42dca3..4b60aac 100644 --- a/deploy/windows/Read-JobPairTimeSamples.ps1 +++ b/deploy/windows/Read-JobPairTimeSamples.ps1 @@ -6,6 +6,7 @@ param( [switch]$AfterRestart ) $ErrorActionPreference = 'Stop' +Add-Type -AssemblyName System.Runtime.Serialization $caseId = '49c230d8-fb5d-4c64-96b6-e0edce03ed90' $bootDir = 'C:\ProgramData\RustDiscoveryBootstrap' $caseDir = Join-Path $bootDir "job-passive-pair-$caseId" diff --git a/deploy/windows/Use-FirstLocalServiceJobWindow.ps1 b/deploy/windows/Use-FirstLocalServiceJobWindow.ps1 index 84eb853..1471d91 100644 --- a/deploy/windows/Use-FirstLocalServiceJobWindow.ps1 +++ b/deploy/windows/Use-FirstLocalServiceJobWindow.ps1 @@ -5,6 +5,7 @@ param( [Parameter(Mandatory)][ValidateSet('Open','Close','Unknown','Recover','Readback')][string]$Action, [guid]$SampleId, [string]$SampleSha256, + [ValidateSet('passive','after-restart')][string]$SampleMode = 'passive', [guid]$JobId, [guid]$AttemptId, [string]$ResultSha256 ) $ErrorActionPreference = 'Stop' @@ -97,7 +98,7 @@ function Start-WindowAgent([string]$Kind) { function Confirm-Samples { if ($SampleId -eq [guid]::Empty -or $SampleSha256 -cnotmatch '^[0-9a-f]{64}$') { throw 'Validated server readback required' } Assert-DirectoryAcl $pairCase $false - $samplePath = Join-Path $pairCase ('samples-passive-'+$SampleId.ToString()+'.json') + $samplePath = Join-Path $pairCase ('samples-'+$SampleMode+'-'+$SampleId.ToString()+'.json') if ((Get-PublicHash $samplePath) -cne $SampleSha256) { throw 'Sample receipt hash mismatch' } Assert-NormalPath $samplePath $false if ((Get-Item -LiteralPath $samplePath).Length -gt 131072) { throw 'Sample receipt too large' } @@ -106,7 +107,7 @@ function Confirm-Samples { $pub = Read-PublicJson $profileReceipt $a = Get-LiveProcess $svcName $image $newAgent $h = Get-LiveProcess $helperName $helperImage $helper - if ($r.session_id -cne $SampleId.ToString() -or $r.pair_case_id -cne $caseId -or $r.mode -cne 'passive' -or + if ($r.session_id -cne $SampleId.ToString() -or $r.pair_case_id -cne $caseId -or $r.mode -cne $SampleMode -or $r.profile_sha256 -cne (Get-PublicHash $clock) -or $r.profile_receipt_sha256 -cne (Get-PublicHash $profileReceipt) -or $pub.configuration.sha256 -cne $r.profile_sha256 -or $r.publication_since -cne $pub.publication_since -or $r.agent_pid -ne $a.pid -or [string]$r.agent_birth_filetime -cne $a.birth -or