From a61f5e7ddae95330a4b81ee2536031b74ce00b7d Mon Sep 17 00:00:00 2001 From: Scott McKenzie Date: Tue, 15 May 2018 00:35:38 +1000 Subject: [PATCH] Changes to MSFT_xIisModule - Add handler to specified site (#305). - Parse verbs correctly (#323). --- .../MSFT_xIisModule/MSFT_xIisModule.psm1 | 31 +++++++++---------- README.md | 2 ++ 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/DSCResources/MSFT_xIisModule/MSFT_xIisModule.psm1 b/DSCResources/MSFT_xIisModule/MSFT_xIisModule.psm1 index efdca6ba0..2c0c6cd95 100644 --- a/DSCResources/MSFT_xIisModule/MSFT_xIisModule.psm1 +++ b/DSCResources/MSFT_xIisModule/MSFT_xIisModule.psm1 @@ -60,15 +60,15 @@ function Get-TargetResource $handler = Get-IisHandler -Name $Name -SiteName $SiteName - if($handler ) + if($handler) { $Ensure = 'Present' $modulePresent = $true; - } - foreach($thisVerb in $handler.Verb) - { - $currentVerbs += $thisVerb + foreach($thisVerb in $handler.Verb.Split(',')) + { + $currentVerbs += $thisVerb + } } $fastCgiSetup = $false @@ -76,8 +76,7 @@ function Get-TargetResource if($handler.Modules -eq 'FastCgiModule') { $fastCgi = Get-WebConfiguration /system.webServer/fastCgi/* ` - -PSPath (Get-IisSitePath ` - -SiteName $SiteName) | ` + -PSPath (Get-IisSitePath) | ` Where-Object{$_.FullPath -ieq $handler.ScriptProcessor} if($fastCgi) { @@ -152,19 +151,19 @@ function Set-TargetResource if(-not $resourceTests.ModulePresent -or -not $resourceTests.ModuleConfigured) { Write-Verbose -Message $LocalizedData.VerboseSetTargetAddHandler - Add-webconfiguration /system.webServer/handlers iis:\ -Value @{ + Add-webconfiguration /system.webServer/handlers -PSPath (Get-IisSitePath -SiteName $SiteName) -Value @{ Name = $Name Path = $RequestPath Verb = $Verb -join ',' - Module = $ModuleType + Modules = $ModuleType ScriptProcessor = $Path } } - if(-not $resourceTests.EndPointSetup) + if(-not $resourceStatus.EndPointSetup) { Write-Verbose -Message $LocalizedData.VerboseSetTargetAddfastCgi - Add-WebConfiguration /system.webServer/fastCgi iis:\ -Value @{ + Add-WebConfiguration /system.webServer/fastCgi (Get-IisSitePath) -Value @{ FullPath = $Path } } @@ -344,19 +343,19 @@ function Test-TargetResourceImpl ) $matchedVerbs = @() - $mismatchVerbs =@() - foreach($thisVerb in $resourceStatus.Verb) + $mismatchVerbs = @() + foreach($thisVerb in $resourceStatus.Verb) { if($Verb -icontains $thisVerb) { Write-Verbose -Message ($LocalizedData.VerboseTestTargetResourceImplVerb ` - -f $Verb) + -f $thisVerb) $matchedVerbs += $thisVerb } else { Write-Verbose -Message ($LocalizedData.VerboseTestTargetResourceImplExtraVerb ` - -f $Verb) + -f $thisVerb) $mismatchVerbs += $thisVerb } } @@ -379,7 +378,7 @@ function Test-TargetResourceImpl $moduleConfigured = $false if($modulePresent -and ` $mismatchVerbs.Count -eq 0 -and ` - $matchedVerbs.Count-eq $Verb.Count -and ` + $matchedVerbs.Count -eq $Verb.Count -and ` $resourceStatus.Path -eq $Path -and ` $resourceStatus.RequestPath -eq $RequestPath) { diff --git a/README.md b/README.md index 86cacc033..2e36c842b 100644 --- a/README.md +++ b/README.md @@ -261,6 +261,8 @@ Please check out common DSC Resources [contributing guidelines](https://github.c ## Versions ### Unreleased +* Updated **xIISModule** to add handler to specified site (#305). +* Updated **xIISModule** to parse verbs correctly (#323). * Updated **xWebSite** to include ability to manage custom logging fields ### 1.20.0.0