Skip to content

Commit 820ac1a

Browse files
authored
Update to v2.0.8 and backport two fixes (#130)
1 parent 79d47ce commit 820ac1a

3 files changed

Lines changed: 9 additions & 7 deletions

File tree

CHANGELOG/v2.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# v2 Changelog
22

3+
## [v2.0.8]
4+
5+
- Fixed an issue with array parameters is key-value pairs (#128).
6+
- ConvertTo-MOFInstance: Include resource properties with empty array value (#127)
7+
38
## [v2.0.7]
49

510
### Main changes

src/PSDesiredStateConfiguration/PSDesiredStateConfiguration.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
RootModule = 'PSDesiredStateConfiguration.psm1'
1010

1111
# Version number of this module.
12-
moduleVersion = '2.0.7'
12+
moduleVersion = '2.0.8'
1313

1414
# Supported PSEditions
1515
CompatiblePSEditions = @('Core')

src/PSDesiredStateConfiguration/PSDesiredStateConfiguration.psm1

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ function ConvertTo-MOFInstance
509509
$targetTypeName = $PropertyTypes[$p.Name].TypeConstraint
510510

511511
# see if the target type is an array
512-
$asArray = $p.Name -eq 'DependsOn' -or $targetTypeName -match 'Array'
512+
$asArray = $p.Name -eq 'DependsOn' -or $targetTypeName -match 'Array' -or ((-not [string]::IsNullOrEmpty($targetTypeName)) -and $targetTypeName.EndsWith('[]'))
513513

514514
# Convert the CIM typename to the appropriate .NET type to use
515515
# to convert the input object into an appropriately encoded string
@@ -671,10 +671,7 @@ function ConvertTo-MOFInstance
671671
}
672672
else
673673
{
674-
if ($targetTypeName -notmatch 'Array' -or $p.Value.Count)
675-
{
676-
$p.Name + ' = ' + (stringify -value $p.Value -asArray $asArray -targetType $targetType ) + ";`n"
677-
}
674+
$p.Name + ' = ' + (stringify -value $p.Value -asArray $asArray -targetType $targetType ) + ";`n"
678675
}
679676
}
680677
}
@@ -4211,7 +4208,7 @@ function GetResourceFromKeyword
42114208
Ascending = $true
42124209
}
42134210
$resource.UpdateProperties($updatedProperties)
4214-
4211+
42154212
$resource | Add-Member -MemberType NoteProperty -Name 'ImplementationDetail' -Value $implementationDetail
42164213

42174214
return $resource

0 commit comments

Comments
 (0)