Standardize driver compression status reporting across vendors

Updates compression workflow to use consistent status messaging and better error handling across all driver vendor modules (Dell, HP, Lenovo, Microsoft).

Changes improve status tracking by:
- Standardizing compression success status to "Compression successful" instead of vendor-specific messages
- Introducing relative path variables to reduce code duplication and improve maintainability
- Suppressing command output by piping to `$null` for cleaner execution
- Adding explicit failure state in exception handlers to ensure success property reflects actual outcome
- Updating parallel processing logic to recognize the new standardized compression status

These modifications ensure consistent behavior across vendors and make the parallel processing coordinator aware of all compression completion states.
This commit is contained in:
rbalsleyMSFT
2025-11-20 14:32:54 -08:00
parent e076e9f4ca
commit 7d36253668
5 changed files with 20 additions and 15 deletions
@@ -157,17 +157,19 @@ function Save-DellDriversTask {
}
if ($CompressToWim -and $existing.Status -eq 'Already downloaded') {
$wimPath = Join-Path $makeDriversPath "$sanitizedModelName.wim"
$wimRelativePath = Join-Path $make "$sanitizedModelName.wim"
$srcPath = Join-Path $makeDriversPath $sanitizedModelName
if ($null -ne $ProgressQueue) { Invoke-ProgressUpdate -ProgressQueue $ProgressQueue -Identifier $modelDisplay -Status 'Compressing existing...' }
try {
Compress-DriverFolderToWim -SourceFolderPath $srcPath -DestinationWimPath $wimPath -WimName $modelDisplay -WimDescription "Drivers for $modelDisplay" -PreserveSource:$PreserveSourceOnCompress -ErrorAction Stop
$existing.Status = 'Already downloaded & Compressed'
$existing.DriverPath = Join-Path $make "$sanitizedModelName.wim"
$null = Compress-DriverFolderToWim -SourceFolderPath $srcPath -DestinationWimPath $wimPath -WimName $modelDisplay -WimDescription "Drivers for $modelDisplay" -PreserveSource:$PreserveSourceOnCompress -ErrorAction Stop
$existing.Status = 'Compression successful'
$existing.DriverPath = $wimRelativePath
$existing.Success = $true
}
catch {
WriteLog "Compression failed for $($modelDisplay): $($_.Exception.Message)"
$existing.Status = 'Already downloaded (Compression failed)'
$existing.Success = $false
}
if ($null -ne $ProgressQueue) { Invoke-ProgressUpdate -ProgressQueue $ProgressQueue -Identifier $modelDisplay -Status $existing.Status }
}
@@ -341,7 +343,7 @@ function Save-DellDriversTask {
if ($null -ne $ProgressQueue) { Invoke-ProgressUpdate -ProgressQueue $ProgressQueue -Identifier $modelDisplay -Status 'Compressing...' }
$wimPath = Join-Path $makeDriversPath "$sanitizedModelName.wim"
try {
Compress-DriverFolderToWim -SourceFolderPath $modelPath -DestinationWimPath $wimPath -WimName $modelDisplay -WimDescription $modelDisplay -PreserveSource:$PreserveSourceOnCompress -ErrorAction Stop
$null = Compress-DriverFolderToWim -SourceFolderPath $modelPath -DestinationWimPath $wimPath -WimName $modelDisplay -WimDescription $modelDisplay -PreserveSource:$PreserveSourceOnCompress -ErrorAction Stop
$driverRelativePath = Join-Path $make "$sanitizedModelName.wim"
$statusFinal = 'Completed & Compressed'
}