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

BREAKING CHANGE: Introducing native ReverseDSC support for the module #442

Open
wants to merge 40 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
066a149
Update MSFT_xIisModule.psm1
NikCharlebois Sep 6, 2019
b7e97df
Merge branch 'dev' into dev
NikCharlebois Sep 6, 2019
acc2236
Update README.md
NikCharlebois Sep 9, 2019
f57afb9
Merge branch 'dev' into dev
NikCharlebois Sep 9, 2019
eb3b17b
Fixed Remove-IISHandler
NikCharlebois Sep 9, 2019
e4dfccf
Merge branch 'dev' of https://github.com/NikCharlebois/xWebAdministra…
NikCharlebois Sep 9, 2019
a2e342b
Cleaned, fixed, and reviewed
NikCharlebois Sep 11, 2019
f3ce2d2
Merge remote-tracking branch 'upstream/dev' into dev
NikCharlebois Sep 11, 2019
49706fc
Update MSFT_xIisModule.psm1
NikCharlebois Sep 11, 2019
542121e
Introduced Native ReverseDSC Support
NikCharlebois Sep 12, 2019
553b8d1
Update appveyor.yml
NikCharlebois Sep 12, 2019
5594221
Fixed tests
NikCharlebois Sep 12, 2019
f886dcb
Fixed tests
NikCharlebois Sep 12, 2019
9b4e598
Update MSFT_xIISModule.Tests.ps1
NikCharlebois Sep 13, 2019
d14ea6f
Fixed tests
NikCharlebois Sep 13, 2019
38be709
Update MSFT_xIisModule.psm1
NikCharlebois Sep 13, 2019
e212623
Fixes mocks
NikCharlebois Sep 13, 2019
b07efda
Updated Resources
NikCharlebois Sep 13, 2019
3e7781d
Trying out unit tests
NikCharlebois Sep 14, 2019
a41b691
Update MSFT_WebApplicationHandler.tests.ps1
NikCharlebois Sep 14, 2019
7d7aed0
added tests
NikCharlebois Sep 15, 2019
7b04e2f
Added remaining Tests
NikCharlebois Sep 16, 2019
df00220
Fixed Tests and re-triggered bad integration test run
NikCharlebois Sep 16, 2019
00b4f8b
Nik
NikCharlebois Sep 16, 2019
f944f08
Fixed broken VirtualDirectory test
NikCharlebois Sep 16, 2019
e04986e
Fixes to empty Physical Path in tests
NikCharlebois Sep 16, 2019
5e3434c
Fixed Review and added coverage
NikCharlebois Sep 16, 2019
dad96e2
Update MSFT_xWebsite.psm1
NikCharlebois Sep 16, 2019
5ad9e56
Added missing tests for xWebSiteDefaults
NikCharlebois Sep 16, 2019
76781d4
Update MSFT_xWebSiteDefaults.Tests.ps1
NikCharlebois Sep 16, 2019
bc49d07
Update MSFT_xWebSiteDefaults.Tests.ps1
NikCharlebois Sep 16, 2019
19c559c
Update MSFT_xWebSiteDefaults.Tests.ps1
NikCharlebois Sep 16, 2019
eea8ce0
Update MSFT_xIISModule.Tests.ps1
NikCharlebois Sep 16, 2019
9979b78
Update MSFT_xIISModule.Tests.ps1
NikCharlebois Sep 16, 2019
86ea1cd
Update MSFT_xWebConfigKeyValue.Tests.ps1
NikCharlebois Sep 16, 2019
a4610b4
Fixed quotes
NikCharlebois Sep 16, 2019
bb21d69
Update MSFT_xWebConfigKeyValue.Tests.ps1
NikCharlebois Sep 16, 2019
5dc1010
Fixes
NikCharlebois Oct 21, 2019
5a7494e
Fixes
NikCharlebois Oct 21, 2019
698aead
Fixes
NikCharlebois Oct 22, 2019
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
Original file line number Diff line number Diff line change
Expand Up @@ -380,4 +380,36 @@ function Test-TargetResource
return $inDesiredState
}

function Export-TargetResource
{
[CmdletBinding()]
[OutputType([System.String])]
param()

$InformationPreference = 'Continue'
Write-Information 'Extracting WebApplicationHandler...'
$handlers = Get-WebConfigurationProperty -Filter 'system.webServer/handlers/Add' -Name '.'

$sb = [System.Text.StringBuilder]::new()
$i = 1
foreach ($handler in $handlers)
{
Write-Information " [$i/$($handlers.Count)] $($handler.name)"
$params = @{
Name = $handler.name
Path = 'IIS://'
Location = $handler.location
}

$results = Get-TargetResource @params
[void]$sb.AppendLine(' WebApplicationHandler ' + (New-Guid).ToString())
[void]$sb.AppendLine(' {')
$dscBlock = Get-DSCBlock -Params $results -ModulePath $PSScriptRoot
[void]$sb.Append($dscBlock)
[void]$sb.AppendLine(' }')
$i++
}
return $sb.ToString()
}

Export-ModuleMember -Function *-TargetResource
34 changes: 34 additions & 0 deletions DSCResources/MSFT_xIIsHandler/MSFT_xIisHandler.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -915,6 +915,40 @@ function Test-TargetResource
}
}

function Export-TargetResource
{
[CmdletBinding()]
[OutputType([System.String])]
param()

$InformationPreference = 'Continue'
Write-Information 'Extracting xIISHandler...'

$handlers = Get-WebConfigurationProperty -PSPath 'MACHINE/WEBROOT/APPHOST' `
-Filter 'system.webServer/handlers/*' `
-Name '.'

$i = 1
$sb = [System.Text.StringBuilder]::new()
foreach ($handler in $handlers)
{
$params = @{
Name = $handler.name
Ensure = 'Present'
}

$results = Get-TargetResource @params
Write-Information " [$i/$($handlers.Count)] $($handler.name)"
[void]$sb.AppendLine(' xIISHandler ' + (New-Guid).ToString())
[void]$sb.AppendLine(' {')
$dscBlock = Get-DSCBlock -Params $results -ModulePath $PSScriptRoot
[void]$sb.Append($dscBlock)
[void]$sb.AppendLine(' }')
$i++
}
return $sb.ToString()
}

#region Helper Functions

function Get-Handler
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,49 @@ function Test-TargetResource
return $false
}

function Export-TargetResource
{
[CmdletBinding()]
[OutputType([System.String])]
param()

$InformationPreference = 'Continue'
Write-Information 'Extracting xIISFeatureDelegation...'

$configSections = Get-WebConfiguration -Filter 'system.webServer/*' -Metadata -Recurse
$sb = [System.Text.StringBuilder]::new()
$i = 1
foreach ($section in $configSections)
{
if ($null -ne $section.SectionPath)
{
Write-Information " [$i/$($configSections.Count)] $($section.SectionPath.Remove(0,1))"
$params = @{
Filter = $section.SectionPath.Remove(0,1)
Path = 'MACHINE/WEBROOT/APPHOST'
OverrideMode = 'Deny'
}

try
{
$results = Get-TargetResource @params
[void]$sb.AppendLine(' xIISFeatureDelegation ' + (New-Guid).ToString())
[void]$sb.AppendLine(' {')
$dscBlock = Get-DSCBlock -Params $results -ModulePath $PSScriptRoot
[void]$sb.Append($dscBlock)
[void]$sb.AppendLine(' }')
}
catch
{
Write-Error $_
}
}
$i++
}

return $sb.ToString()
}

#region Helper functions
<#
.SYNOPSIS
Expand Down
27 changes: 27 additions & 0 deletions DSCResources/MSFT_xIisLogging/MSFT_xIisLogging.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,33 @@ function Test-TargetResource

}

function Export-TargetResource
{
[CmdletBinding()]
[OutputType([System.String])]
param()

$InformationPreference = 'Continue'
Write-Information 'Extracting xIISLogging...'

$LogSettings = Get-WebConfiguration -Filter '/system.applicationHost/sites/siteDefaults/Logfile'

$params = @{
LogPath = $LogSettings.directory
}
$sb = [System.Text.StringBuilder]::new()
$results = Get-TargetResource @params
$results.LogFlags = $results.LogFlags.Split(',')
[void]$sb.AppendLine(' xIISLogging ' + (New-Guid).ToString())
[void]$sb.AppendLine(' {')
$dscBlock = Get-DSCBlock -Params $results -ModulePath $PSScriptRoot
[void]$sb.Append($dscBlock)
[void]$sb.AppendLine(' }')

return $sb.ToString()

}

#region Helper functions

<#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,39 @@ function Test-TargetResource
return $desiredConfigurationMatch
}

function Export-TargetResource
{
[CmdletBinding()]
[OutputType([System.String])]
param()

$InformationPreference = 'Continue'
Write-Information 'Extracting xIISMimeTypeMapping...'

$MimeMap = Get-WebConfiguration -Filter 'system.webServer/staticContent/mimeMap'

$i = 1
$sb = [System.Text.StringBuilder]::new()
foreach ($mimeType in $MimeMap)
{
Write-Information " [$i/$($MimeMap.Count)] $($mimeType.mimeType)"
$params =@{
ConfigurationPath = $mimeType.PSPath
Extension = $mimeType.fileExtension
MimeType = $mimeType.mimeType
Ensure = 'Present'
}
$results = Get-TargetResource @params
[void]$sb.AppendLine(' xIISMimeTypeMapping ' + (New-Guid).ToString())
[void]$sb.AppendLine(' {')
$dscBlock = Get-DSCBlock -Params $results -ModulePath $module
[void]$sb.Append($dscBlock)
[void]$sb.AppendLine(' }')
$i++
}
return $sb.ToString()
}

#region Helper Functions

<#
Expand Down
Loading