Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attempt to fix MSFT_xIisModule #354

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 15 additions & 16 deletions DSCResources/MSFT_xIisModule/MSFT_xIisModule.psm1
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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