fix(agent99): normalize empty preflight blockers
This commit is contained in:
@@ -259,12 +259,13 @@ function Invoke-AgentLivePreflight {
|
||||
try { $payload = $match.Groups["json"].Value | ConvertFrom-Json } catch { $payload = $null }
|
||||
}
|
||||
$summary = if ($payload -and $payload.PSObject.Properties["summary"]) { $payload.summary } else { $null }
|
||||
[string[]]$blockingReasons = if ($processResult.timedOut) {
|
||||
@("preflight_process_timeout")
|
||||
} elseif ($summary) {
|
||||
@($summary.blockingReasons | ForEach-Object { [string]$_ })
|
||||
} else {
|
||||
@("preflight_output_unparseable")
|
||||
[string[]]$blockingReasons = @()
|
||||
if ($processResult.timedOut) {
|
||||
$blockingReasons = @("preflight_process_timeout")
|
||||
} elseif (-not $summary) {
|
||||
$blockingReasons = @("preflight_output_unparseable")
|
||||
} elseif ($null -ne $summary.blockingReasons) {
|
||||
$blockingReasons = @($summary.blockingReasons | ForEach-Object { [string]$_ })
|
||||
}
|
||||
[string[]]$externalBlockingReasons = @($blockingReasons | Where-Object { $_ -eq "self_health_not_ok" })
|
||||
[string[]]$runtimePlaneBlockingReasons = @($blockingReasons | Where-Object { $_ -ne "self_health_not_ok" })
|
||||
|
||||
@@ -502,6 +502,9 @@ def test_receiver_scopes_deploy_health_separately_from_external_asset_health() -
|
||||
assert '[int]$summary.alertRunningCount -eq 0' in preflight
|
||||
assert '[int]$summary.pendingCommandCount -eq 0' in preflight
|
||||
assert '$runtimePlaneBlockingReasons.Count -eq 0' in preflight
|
||||
assert '[string[]]$blockingReasons = @()' in preflight
|
||||
assert '$null -ne $summary.blockingReasons' in preflight
|
||||
assert '$summary.blockingReasons | ForEach-Object' in preflight
|
||||
assert 'externalDegraded = [bool](' in preflight
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user