Skip to content

Commit

Permalink
Merge pull request #19 from briantist/Version-1.0.2.0
Browse files Browse the repository at this point in the history
Version 1.0.2.0
  • Loading branch information
briantist authored Jul 9, 2017
2 parents b032c72 + 7854527 commit 15836b7
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 5 deletions.
24 changes: 20 additions & 4 deletions Data/Definitions.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,14 @@ param(
)
${Snippet_Parameterizerator}
if (`$PSCmdlet.ShouldProcess('${Verb}', '${Resource} DSC Resource')) {
Invoke-DscResource -Name '${Resource}' -ModuleName '${ModuleName}' -Method '${Verb}' -Property `$params -Verbose:`$VerbosePreference
if (`$PSCmdlet.ShouldProcess('${Resource} DSC Resource', '${Verb}')) {
`$oldVerbosePreference = `$VerbosePreference
`$VerbosePreference = [System.Management.Automation.ActionPreference]::SilentlyContinue
Invoke-DscResource -Name '${Resource}' -ModuleName '${ModuleName}' -Method '${Verb}' -Property `$params -Verbose:`$oldVerbosePreference
`$VerbosePreference = `$oldVerbosePreference
}
}
'@
Expand All @@ -36,7 +42,12 @@ param(
)
${Snippet_Parameterizerator}
Invoke-DscResource -Name '${Resource}' -ModuleName '${ModuleName}' -Method '${Verb}' -Property `$params -Verbose:`$VerbosePreference
`$oldVerbosePreference = `$VerbosePreference
`$VerbosePreference = [System.Management.Automation.ActionPreference]::SilentlyContinue
Invoke-DscResource -Name '${Resource}' -ModuleName '${ModuleName}' -Method '${Verb}' -Property `$params -Verbose:`$oldVerbosePreference
`$VerbosePreference = `$oldVerbosePreference
}
'@

Expand All @@ -49,7 +60,12 @@ param(
)
${Snippet_Parameterizerator}
Invoke-DscResource -Name '${Resource}' -ModuleName '${ModuleName}' -Method '${Verb}' -Property `$params -Verbose:`$VerbosePreference
`$oldVerbosePreference = `$VerbosePreference
`$VerbosePreference = [System.Management.Automation.ActionPreference]::SilentlyContinue
Invoke-DscResource -Name '${Resource}' -ModuleName '${ModuleName}' -Method '${Verb}' -Property `$params -Verbose:`$oldVerbosePreference
`$VerbosePreference = `$oldVerbosePreference
}
'@

Expand Down
Binary file modified Idempotion.psd1
Binary file not shown.
1 change: 1 addition & 0 deletions Private/New-ParameterFromResourcePropertyInfo.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ InModuleScope $Module.Name {
'Present'
,'Absent'
,"Single ' Quote"
,"Weird ’ Quote"
)
}
$testNoSet = [PSCustomObject]@{
Expand Down
2 changes: 1 addition & 1 deletion Private/New-ParameterFromResourcePropertyInfo.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ param(
Process {
$valset = if (-not $NoValidateSet -and $Values.Count) {
$set = $Values.ForEach( {
$escaped = $_.Replace("'" , "''")
$escaped = [System.Management.Automation.Language.CodeGeneration]::EscapeSingleQuotedStringContent($_)
"'$escaped'"
} ) -join ','
"[ValidateSet($set)]"
Expand Down

0 comments on commit 15836b7

Please sign in to comment.