Skip to content

Commit

Permalink
feat: Confirm-PolicyDefinitionIsValid.ps1 returns different exit code…
Browse files Browse the repository at this point in the history
…s for success, warnings and error
  • Loading branch information
aschabus committed Aug 22, 2023
1 parent fed7fab commit 9a7453b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Scripts/Confirm-PolicyDefinitionIsValid.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,17 @@ if ($errorMessages.Count -gt 0) {
$messagesString += (($warningMessages.ToArray()) -join "`n ")
}
Write-Host $messagesString -ForegroundColor Red
exit 2 # Errors found
}
else {
if ($warningMessages.Count -gt 0) {
$messagesString = "'$($file.FullName)' has auto-fix warnings:`n "
$messagesString += (($warningMessages.ToArray()) -join "`n ")
Write-Host $messagesString -ForegroundColor Yellow
exit 3 # Warnings found
}
else {
Write-Host "'$($file.FullName)' is valid." -ForegroundColor Blue
exit 0 # No errors or warnings foundS
}
}
}

0 comments on commit 9a7453b

Please sign in to comment.