Skip to content
This repository has been archived by the owner on Jan 20, 2023. It is now read-only.

Commit

Permalink
fix exception handling for database move failures
Browse files Browse the repository at this point in the history
  • Loading branch information
doherty100 committed Sep 16, 2022
1 parent d3f5534 commit 7f7d448
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions terraform-azurerm-vnet-app/configure-vm-mssql.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -211,15 +211,15 @@ function Move-SqlDatabase {

Write-Log "Move-SqlDatabase: Moving '$Name' database data file from '$currentDataFilePath' to '$newDataFilePath'..."
try {
Move-Item -Path $currentDataFilePath -Destination $newDataFilePath
Move-Item -Path $currentDataFilePath -Destination $newDataFilePath -Force -ErrorAction Stop
}
catch {
Exit-WithError $_
}

Write-Log "Move-SqlDatabase: Moving '$Name' database log file from '$currentLogFilePath' to '$newLogFilePath'..."
try {
Move-Item -Path $currentLogFilePath -Destination $newLogFilePath
Move-Item -Path $currentLogFilePath -Destination $newLogFilePath -Force -ErrorAction Stop
}
catch {
Exit-WithError $_
Expand Down Expand Up @@ -403,7 +403,7 @@ foreach ( $volume in $volumes) {
}

if ( $volume.FileSystemLabel -eq "Temporary Storage" ) {
Write-Log "Located local temporary disk at $path..."
Write-Log "Located local temporary disk at '$($volume.DriveLetter)'..."
$path = "$($volume.DriveLetter):\SQLTEMP"

if ( -not ( Test-Path $path ) ) {
Expand Down

0 comments on commit 7f7d448

Please sign in to comment.