Skip to content

Commit

Permalink
Merge pull request #207 from PowerShell/dev
Browse files Browse the repository at this point in the history
Release of version 4.7.0.0 of StorageDsc
  • Loading branch information
kwirkykat authored May 15, 2019
2 parents 7e24abb + 8036a4b commit ac00be4
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 44 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

## Unreleased

## 4.7.0.0

- DiskAccessPath:
- Added a Get-Partition to properly handle setting the NoDefaultDriveLetter
parameter - fixes [Issue #198](https://github.com/PowerShell/StorageDsc/pull/198).

## 4.6.0.0

- Fix example publish to PowerShell Gallery by adding `gallery_api`
Expand Down
25 changes: 14 additions & 11 deletions DSCResources/MSFT_DiskAccessPath/MSFT_DiskAccessPath.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -518,22 +518,25 @@ function Set-TargetResource
) -join '' )
} # if

# Get the partitions on the disk
$partition = $disk | Get-Partition -ErrorAction SilentlyContinue

# Get the current partition state for NoDefaultDriveLetter
$assignedPartition = $partition |
Where-Object -Property AccessPaths -Contains -Value $AccessPath

if ($assignedPartition.NoDefaultDriveLetter -ne $NoDefaultDriveLetter)
{
Write-Verbose -Message ( @(
"$($MyInvocation.MyCommand): "
"$($localizedData.NoDefaultDriveLetterMismatchMessage -f $assignedPartition.NoDefaultDriveLetter, $NoDefaultDriveLetter)"
) -join '' )
if ($assignedPartition.NoDefaultDriveLetter -ne $NoDefaultDriveLetter)
{
Write-Verbose -Message ( @(
"$($MyInvocation.MyCommand): "
"$($localizedData.NoDefaultDriveLetterMismatchMessage -f $assignedPartition.NoDefaultDriveLetter, $NoDefaultDriveLetter)"
) -join '' )

# Setting the partition property NoDefaultDriveLetter to True to prevent adding drive letter on reboot
Set-Partition -PartitionNumber $assignedPartition.PartitionNumber `
-DiskNumber $disk.Number `
-NoDefaultDriveLetter $NoDefaultDriveLetter
} # if
# Setting the partition property NoDefaultDriveLetter
Set-Partition -PartitionNumber $assignedPartition.PartitionNumber `
-DiskNumber $disk.Number `
-NoDefaultDriveLetter $NoDefaultDriveLetter
} # if
} # Set-TargetResource

<#
Expand Down
11 changes: 7 additions & 4 deletions DSCResources/MSFT_OpticalDiskDriveLetter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,11 @@ With the Device ID, we look for the length of the string after the final
backslash (crude, but appears to work so far).

Example:
# DeviceID for a virtual drive in a Hyper-V VM
SCSI\CDROM&VEN_MSFT&PROD_VIRTUAL_DVD-ROM\**000006**

# DeviceID for a mounted ISO in a Hyper-V VM
SCSI\CDROM&VEN_MSFT&PROD_VIRTUAL_DVD-ROM\**2&1F4ADFFE&0&000002**
```powershell
# DeviceID for a virtual drive in a Hyper-V VM
"SCSI\CDROM&VEN_MSFT&PROD_VIRTUAL_DVD-ROM\**000006**"
# DeviceID for a mounted ISO in a Hyper-V VM
"SCSI\CDROM&VEN_MSFT&PROD_VIRTUAL_DVD-ROM\**2&1F4ADFFE&0&000002**"
```
23 changes: 5 additions & 18 deletions StorageDsc.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# RootModule = ''

# Version number of this module.
moduleVersion = '4.6.0.0'
moduleVersion = '4.7.0.0'

# ID used to uniquely identify this module
GUID = '00d73ca1-58b5-46b7-ac1a-5bfcf5814faf'
Expand Down Expand Up @@ -102,23 +102,9 @@
# IconUri = ''

# ReleaseNotes of this module
ReleaseNotes = '- Fix example publish to PowerShell Gallery by adding `gallery_api`
environment variable to `AppVeyor.yml` - fixes [Issue 202](https://github.com/PowerShell/StorageDsc/issues/202).
- Added "DscResourcesToExport" to manifest to improve information in
PowerShell Gallery and removed wildcards from "FunctionsToExport",
"CmdletsToExport", "VariablesToExport" and "AliasesToExport" - fixes
[Issue 192](https://github.com/PowerShell/StorageDsc/issues/192).
- Clean up module manifest to correct Author and Company - fixes
[Issue 191](https://github.com/PowerShell/StorageDsc/issues/191).
- Correct unit tests for DiskAccessPath to test exact number of
mocks called - fixes [Issue 199](https://github.com/PowerShell/StorageDsc/issues/199).
- Disk:
- Added minimum timetowate of 3s after new-partition using the while loop.
The problem occurs when the partition is created and the format-volume
is attempted before the volume has completed.
There appears to be no property to determine if the partition is
sufficiently ready to format and it will often format as a raw volume when
the error occurs - fixes [Issue 85](https://github.com/PowerShell/StorageDsc/issues/85).
ReleaseNotes = '- DiskAccessPath:
- Added a Get-Partition to properly handle setting the NoDefaultDriveLetter
parameter - fixes [Issue 198](https://github.com/PowerShell/StorageDsc/pull/198).
'

Expand All @@ -133,3 +119,4 @@
# DefaultCommandPrefix = ''
}


22 changes: 11 additions & 11 deletions Tests/Unit/MSFT_DiskAccessPath.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,7 @@ try
-ParameterFilter $script:parameterFilter_Disk0OfflineDiskIdNumber
Assert-MockCalled -CommandName Set-Disk -Exactly -Times 1
Assert-MockCalled -CommandName Initialize-Disk -Exactly -Times 0
Assert-MockCalled -CommandName Get-Partition -Exactly -Times 1
Assert-MockCalled -CommandName Get-Partition -Exactly -Times 2
Assert-MockCalled -CommandName Get-Volume -Exactly -Times 1
Assert-MockCalled -CommandName New-Partition -Exactly -Times 1
Assert-MockCalled -CommandName Format-Volume -Exactly -Times 1
Expand Down Expand Up @@ -724,7 +724,7 @@ try
-ParameterFilter $script:parameterFilter_Disk0OfflineDiskIdUniqueId
Assert-MockCalled -CommandName Set-Disk -Exactly -Times 1
Assert-MockCalled -CommandName Initialize-Disk -Exactly -Times 0
Assert-MockCalled -CommandName Get-Partition -Exactly -Times 1
Assert-MockCalled -CommandName Get-Partition -Exactly -Times 2
Assert-MockCalled -CommandName Get-Volume -Exactly -Times 1
Assert-MockCalled -CommandName New-Partition -Exactly -Times 1
Assert-MockCalled -CommandName Format-Volume -Exactly -Times 1
Expand Down Expand Up @@ -797,7 +797,7 @@ try
-ParameterFilter $script:parameterFilter_Disk0OfflineDiskIdGuid
Assert-MockCalled -CommandName Set-Disk -Exactly -Times 1
Assert-MockCalled -CommandName Initialize-Disk -Exactly -Times 0
Assert-MockCalled -CommandName Get-Partition -Exactly -Times 1
Assert-MockCalled -CommandName Get-Partition -Exactly -Times 2
Assert-MockCalled -CommandName Get-Volume -Exactly -Times 1
Assert-MockCalled -CommandName New-Partition -Exactly -Times 1
Assert-MockCalled -CommandName Format-Volume -Exactly -Times 1
Expand Down Expand Up @@ -869,7 +869,7 @@ try
-ParameterFilter $script:parameterFilter_Disk0ReadonlyDiskIdNumber
Assert-MockCalled -CommandName Set-Disk -Exactly -Times 1
Assert-MockCalled -CommandName Initialize-Disk -Exactly -Times 0
Assert-MockCalled -CommandName Get-Partition -Exactly -Times 1
Assert-MockCalled -CommandName Get-Partition -Exactly -Times 2
Assert-MockCalled -CommandName Get-Volume -Exactly -Times 1
Assert-MockCalled -CommandName New-Partition -Exactly -Times 1
Assert-MockCalled -CommandName Format-Volume -Exactly -Times 1
Expand Down Expand Up @@ -943,7 +943,7 @@ try
-ParameterFilter $script:parameterFilter_Disk0OfflineRawDiskIdNumber
Assert-MockCalled -CommandName Set-Disk -Exactly -Times 1
Assert-MockCalled -CommandName Initialize-Disk -Exactly -Times 1
Assert-MockCalled -CommandName Get-Partition -Exactly -Times 1
Assert-MockCalled -CommandName Get-Partition -Exactly -Times 2
Assert-MockCalled -CommandName Get-Volume -Exactly -Times 1
Assert-MockCalled -CommandName New-Partition -Exactly -Times 1
Assert-MockCalled -CommandName Format-Volume -Exactly -Times 1
Expand Down Expand Up @@ -1014,7 +1014,7 @@ try
-ParameterFilter $script:parameterFilter_Disk0RawDiskIdNumber
Assert-MockCalled -CommandName Set-Disk -Exactly -Times 0
Assert-MockCalled -CommandName Initialize-Disk -Exactly -Times 1
Assert-MockCalled -CommandName Get-Partition -Exactly -Times 1
Assert-MockCalled -CommandName Get-Partition -Exactly -Times 2
Assert-MockCalled -CommandName Get-Volume -Exactly -Times 1
Assert-MockCalled -CommandName New-Partition -Exactly -Times 1
Assert-MockCalled -CommandName Format-Volume -Exactly -Times 1
Expand Down Expand Up @@ -1083,7 +1083,7 @@ try
-ParameterFilter $script:parameterFilter_Disk0DiskIdNumber
Assert-MockCalled -CommandName Set-Disk -Exactly -Times 0
Assert-MockCalled -CommandName Initialize-Disk -Exactly -Times 0
Assert-MockCalled -CommandName Get-Partition -Exactly -Times 1
Assert-MockCalled -CommandName Get-Partition -Exactly -Times 2
Assert-MockCalled -CommandName Get-Volume -Exactly -Times 1
Assert-MockCalled -CommandName New-Partition -Exactly -Times 1
Assert-MockCalled -CommandName Format-Volume -Exactly -Times 1
Expand Down Expand Up @@ -1291,7 +1291,7 @@ try
-ParameterFilter $script:parameterFilter_Disk0DiskIdNumber
Assert-MockCalled -CommandName Set-Disk -Exactly -Times 0
Assert-MockCalled -CommandName Initialize-Disk -Exactly -Times 0
Assert-MockCalled -CommandName Get-Partition -Exactly -Times 1
Assert-MockCalled -CommandName Get-Partition -Exactly -Times 2
Assert-MockCalled -CommandName Get-Volume -Exactly -Times 1
Assert-MockCalled -CommandName New-Partition -Exactly -Times 0
Assert-MockCalled -CommandName Format-Volume -Exactly -Times 0
Expand Down Expand Up @@ -1354,7 +1354,7 @@ try
-ParameterFilter $script:parameterFilter_Disk0DiskIdNumber
Assert-MockCalled -CommandName Set-Disk -Exactly -Times 0
Assert-MockCalled -CommandName Initialize-Disk -Exactly -Times 0
Assert-MockCalled -CommandName Get-Partition -Exactly -Times 1
Assert-MockCalled -CommandName Get-Partition -Exactly -Times 2
Assert-MockCalled -CommandName Get-Volume -Exactly -Times 1
Assert-MockCalled -CommandName New-Partition -Exactly -Times 0
Assert-MockCalled -CommandName Format-Volume -Exactly -Times 0
Expand Down Expand Up @@ -1417,7 +1417,7 @@ try
-ParameterFilter $script:parameterFilter_Disk0DiskIdNumber
Assert-MockCalled -CommandName Set-Disk -Exactly -Times 0
Assert-MockCalled -CommandName Initialize-Disk -Exactly -Times 0
Assert-MockCalled -CommandName Get-Partition -Exactly -Times 1
Assert-MockCalled -CommandName Get-Partition -Exactly -Times 2
Assert-MockCalled -CommandName Get-Volume -Exactly -Times 2
Assert-MockCalled -CommandName New-Partition -Exactly -Times 0
Assert-MockCalled -CommandName Format-Volume -Exactly -Times 0
Expand Down Expand Up @@ -1478,7 +1478,7 @@ try
-ParameterFilter $script:parameterFilter_Disk0DiskIdNumber
Assert-MockCalled -CommandName Set-Disk -Exactly -Times 0
Assert-MockCalled -CommandName Initialize-Disk -Exactly -Times 0
Assert-MockCalled -CommandName Get-Partition -Exactly -Times 1
Assert-MockCalled -CommandName Get-Partition -Exactly -Times 2
Assert-MockCalled -CommandName Get-Volume -Exactly -Times 1
Assert-MockCalled -CommandName New-Partition -Exactly -Times 0
Assert-MockCalled -CommandName Format-Volume -Exactly -Times 0
Expand Down

0 comments on commit ac00be4

Please sign in to comment.