Skip to content

Commit

Permalink
Fix hashtable format dsccommunity#219
Browse files Browse the repository at this point in the history
  • Loading branch information
PlagueHO committed Nov 16, 2019
1 parent cb58b9d commit b6af4a6
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Unreleased

- Fixed hash table style violations - fixes [Issue #219](https://github.com/PowerShell/StorageDsc/issues/219).

## 4.9.0.0

- Disk:
Expand Down
17 changes: 13 additions & 4 deletions DSCResources/MSFT_MountImage/MSFT_MountImage.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -518,10 +518,15 @@ function Mount-DiskImageToLetter
$normalizedDriveLetter = Assert-DriveLetterValid -DriveLetter $DriveLetter

# Mount the Diskimage
$mountParams = @{ ImagePath = $ImagePath }
$mountParams = @{
ImagePath = $ImagePath
}

if ($PSBoundParameters.ContainsKey('Access'))
{
$mountParams += @{ Access = $Access }
$mountParams += @{
Access = $Access
}
} # if
$null = Mount-DiskImage @mountParams

Expand Down Expand Up @@ -572,11 +577,15 @@ function Mount-DiskImageToLetter
DeviceId in the ObjectId string to match volumes.
#>
$cimVolume = Get-CimInstance -ClassName Win32_Volume |
Where-Object -FilterScript { $volume.ObjectId.IndexOf($_.DeviceId) -ne -1 }
Where-Object -FilterScript {
$volume.ObjectId.IndexOf($_.DeviceId) -ne -1
}

Set-CimInstance `
-InputObject $cimVolume `
-Property @{ DriveLetter = "$($normalizedDriveLetter):" }
-Property @{
DriveLetter = "$($normalizedDriveLetter):"
}
} # if
} # Mount-DiskImageToLetter

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,9 @@ function Set-TargetResource
$($script:localizedData.AttemptingToRemoveDriveLetter -f $diskId, $currentDriveLetter)
) -join '' )

$volume | Set-CimInstance -Property @{ DriveLetter = $null }
$volume | Set-CimInstance -Property @{
DriveLetter = $null
}
}
else
{
Expand All @@ -248,7 +250,9 @@ function Set-TargetResource
$($script:localizedData.AttemptingToSetDriveLetter -f $diskId, $currentDriveLetter, $DriveLetter)
) -join '' )

$volume | Set-CimInstance -Property @{ DriveLetter = $DriveLetter }
$volume | Set-CimInstance -Property @{
DriveLetter = $DriveLetter
}
}
} # Set-TargetResource

Expand Down

0 comments on commit b6af4a6

Please sign in to comment.