Skip to content

Commit

Permalink
Changes to MSFT_xIisModule
Browse files Browse the repository at this point in the history
- Add handler to specified site (dsccommunity#305).
- Parse verbs correctly (dsccommunity#323).
  • Loading branch information
scottmckenzie committed May 14, 2018
1 parent f18f516 commit a61f5e7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
31 changes: 15 additions & 16 deletions DSCResources/MSFT_xIisModule/MSFT_xIisModule.psm1
Expand Up @@ -60,24 +60,23 @@ 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

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)
{
Expand Down Expand Up @@ -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
}
}
Expand Down Expand Up @@ -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
}
}
Expand All @@ -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)
{
Expand Down
2 changes: 2 additions & 0 deletions README.md
Expand Up @@ -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
Expand Down

0 comments on commit a61f5e7

Please sign in to comment.