Skip to content

Commit

Permalink
fix: error in invoke-wafqueryloop
Browse files Browse the repository at this point in the history
  • Loading branch information
kpoineal committed Feb 4, 2025
1 parent de83649 commit a4f4314
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/modules/wara/collector/collector.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -192,12 +192,11 @@ function Invoke-WAFQueryLoop {
$return = $QueryObject.Where({ $_.automationAvailable -eq $true -and $_.recommendationMetadataState -eq "Active" -and [string]::IsNullOrEmpty($_.recommendationTypeId) }) | ForEach-Object {
Write-Progress -Activity 'Running Queries' -Status "Running Query for $($_.recommendationResourceType) - $($_.aprlGuid)" -PercentComplete (($QueryObject.IndexOf($_) / $QueryObject.Count) * 100) -Id $ProgressId
try {
(Invoke-WAFQuery -Query $_.query -SubscriptionIds $subscriptionIds -ErrorAction Stop)
$recommendation = $_
(Invoke-WAFQuery -Query $recommendation.query -SubscriptionIds $subscriptionIds -ErrorAction Stop)
}
catch {
$errorInfo = "Error running query for - $($_.recommendationResourceType) - $($_.aprlGuid)"
Write-Error $errorInfo
return $errorInfo
Write-Error "Error running query for - $($recommendation.recommendationResourceType) - $($recommendation.aprlGuid)"
}
}
Write-Progress -Activity 'Running Queries' -Status 'Completed' -Completed -Id $ProgressId
Expand Down

0 comments on commit a4f4314

Please sign in to comment.