Skip to content

Commit

Permalink
improve msi log readability
Browse files Browse the repository at this point in the history
  • Loading branch information
gtrevi committed Mar 15, 2024
1 parent f596a29 commit 5fcda40
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions scripts/install_ebpf.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -178,17 +178,17 @@ function Install-eBPFComponents

# Install the MSI package.
try {
$arguments = "/i $MsiPath ADDLOCAL=ALL /qn /norestart /l*vx msi-install.log"
$arguments = "/i $MsiPath ADDLOCAL=ALL /qn /norestart /l*v msi-install.log"
Write-Log("Installing the eBPF MSI package: 'msiexec.exe $arguments'...")
$process = Start-Process -FilePath msiexec.exe -ArgumentList $arguments -Wait -PassThru
if ($process.ExitCode -ne 0) {
Write-Log("MSI installation FAILED. Exit code: $($process.ExitCode)") -ForegroundColor Red
$logContents = Get-Content -Path "msi-install.log" -ErrorAction SilentlyContinue
if ($logContents) {
Write-Log("Contents of msi-install.log:")
Write-Log($logContents)
} else {
Write-Log("msi-install.log not found or empty.") -ForegroundColor Red

# For clear readability within the CICD pipeline and final uploaded log output,
# read each line of the log file and print it (otherwise all the log content is printed as a single line).
Write-Log("Contents of msi-install.log:")
Get-Content -Path "msi-install.log" | ForEach-Object {
Write-Log($_)
}
throw ("MSI installation FAILED. Exit code: $($process.ExitCode)")
}
Expand Down Expand Up @@ -309,12 +309,12 @@ function Uninstall-eBPFComponents
} else {
$exceptionMessage = "Uninstallation FAILED. Exit code: $($process.ExitCode)"
Write-Log($exceptionMessage) -ForegroundColor Red
$logContents = Get-Content -Path "msi-uninstall.log" -ErrorAction SilentlyContinue
if ($logContents) {
Write-Log("Contents of msi-uninstall.log:")
Write-Log($logContents)
} else {
Write-Log("msi-uninstall.log not found or empty.") -ForegroundColor Red

# For clear readability within the CICD pipeline and final uploaded log output,
# read each line of the log file and print it (otherwise all the log content is printed as a single line).
Write-Log("Contents of msi-uninstall.log:")
Get-Content -Path "msi-uninstall.log" | ForEach-Object {
Write-Log($_)
}
}

Expand Down

0 comments on commit 5fcda40

Please sign in to comment.