diff --git a/DSCResources/MSFT_xDnsServerADZone/MSFT_xDnsServerADZone.psm1 b/DSCResources/MSFT_xDnsServerADZone/MSFT_xDnsServerADZone.psm1 index 8cf3a8e5..859b1671 100644 --- a/DSCResources/MSFT_xDnsServerADZone/MSFT_xDnsServerADZone.psm1 +++ b/DSCResources/MSFT_xDnsServerADZone/MSFT_xDnsServerADZone.psm1 @@ -69,7 +69,6 @@ function Get-TargetResource ReplicationScope = $dnsServerZone.ReplicationScope DirectoryPartitionName = $dnsServerZone.DirectoryPartitionName Ensure = if ($dnsServerZone -eq $null) { 'Absent' } else { 'Present' } - CimSession = $cimSession } return $targetResource } #end function Get-TargetResource diff --git a/README.md b/README.md index 98628698..cb6c3584 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,9 @@ The **xDnsServer** DSC resources configure and manage a DNS server. They include **xDnsServerPrimaryZone**, **xDnsServerSecondaryZone**, **xDnsServerADZone**, **xDnsServerZoneTransfer** and **xDnsARecord**. +This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). +For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. + ## Contributing Please check out common DSC Resources [contributing guidelines](https://github.com/PowerShell/DscResource.Kit/blob/master/CONTRIBUTING.md). @@ -59,7 +62,7 @@ Secondary zones allow client machine in primary DNS zones to do DNS resolution o ### xDnsServerZoneTransfer * **Name**: Name of the DNS zone -* **Type**: Type of transfer allowed. +* **Type**: Type of transfer allowed. Values include: { None | Any | Named | Specific } * **SecondaryServer**: IP address or DNS name of DNS servers where zone information can be transfered. @@ -82,6 +85,11 @@ Values include: { ARecord | CName } ### Unreleased +### 1.8.0.0 + +* Converted AppVeyor.yml to pull Pester from PSGallery instead of Chocolatey +* Fixed bug in xDnsServerADZone causing Get-TargetResource to fail with an extra property. + ### 1.7.0.0 * Unit tests updated to use standard unit test templates. @@ -121,7 +129,7 @@ This will replace xDnsARecord in a future release. ### 1.0 -* Initial release with the following resources +* Initial release with the following resources * **xDnsServerSecondaryZone** * **xDnsServerZoneTransfer** @@ -135,7 +143,7 @@ configuration Sample_Set_Forwarders Import-DscResource -module xDnsServer xDnsServerForwarder SetForwarders { - IsSingleInstance = 'Yes' + IsSingleInstance = 'Yes' IPAddresses = '192.168.0.10','192.168.0.11' } } @@ -231,19 +239,19 @@ configuration Sample_xDnsServerPrimaryZone [Parameter()] [ValidateNotNullOrEmpty()] [String]$ZoneFile = "$ZoneName.dns", [Parameter()] [ValidateSet('None','NonsecureAndSecure')] - [String]$DynamicUpdate = 'None' + [String]$DynamicUpdate = 'None' ) - + Import-DscResource -module xDnsServer xDnsServerPrimaryZone addPrimaryZone { - Ensure = 'Present' + Ensure = 'Present' Name = $ZoneName ZoneFile = $ZoneFile DynamicUpdate = $DynamicUpdate } } -Sample_xDnsServerPrimaryZone -ZoneName 'demo.contoso.com' -DyanmicUpdate 'NonsecureAndSecure' +Sample_xDnsServerPrimaryZone -ZoneName 'demo.contoso.com' -DyanmicUpdate 'NonsecureAndSecure' ``` ### Configuring a Secondary DNS Zone @@ -262,13 +270,13 @@ configuration Sample_xDnsServerSecondaryZone Import-DscResource -module xDnsServer xDnsServerSecondaryZone sec { - Ensure = 'Present' + Ensure = 'Present' Name = $ZoneName MasterServers = $SecondaryDnsServer } } -Sample_xDnsServerSecondaryZone -ZoneName 'demo.contoso.com' -SecondaryDnsServer '192.168.10.2' +Sample_xDnsServerSecondaryZone -ZoneName 'demo.contoso.com' -SecondaryDnsServer '192.168.10.2' ``` ### Adding a DNS ARecord @@ -281,12 +289,12 @@ configuration Sample_Arecord { Name = "testArecord" Target = "192.168.0.123" - Zone = "contoso.com" - Type = "ARecord" + Zone = "contoso.com" + Type = "ARecord" Ensure = "Present" } } -Sample_Arecord +Sample_Arecord ``` ### Adding round-robin DNS ARecords @@ -299,21 +307,21 @@ configuration Sample_RoundRobin_Arecord { Name = "testArecord" Target = "192.168.0.123" - Zone = "contoso.com" - Type = "ARecord" + Zone = "contoso.com" + Type = "ARecord" Ensure = "Present" } xDnsRecord TestRecord2 { Name = "testArecord" Target = "192.168.0.124" - Zone = "contoso.com" - Type = "ARecord" + Zone = "contoso.com" + Type = "ARecord" Ensure = "Present" } } -Sample_RoundRobin_Arecord +Sample_RoundRobin_Arecord ``` ### Adding a DNS CName @@ -326,12 +334,12 @@ configuration Sample_CName { Name = "testCName" Target = "test.contoso.com" - Zone = "contoso.com" - Type = "CName" + Zone = "contoso.com" + Type = "CName" Ensure = "Present" } } -Sample_Crecord +Sample_Crecord ``` ### Removing a DNS A Record @@ -345,8 +353,8 @@ configuration Sample_Remove_Record Name = "testArecord" Target = "192.168.0.123" Zone = "contoso.com" - Type = "ARecord" - Ensure = "Absent" + Type = "ARecord" + Ensure = "Absent" } } Sample_Sample_Remove_Record diff --git a/Tests/Unit/MSFT_xDnsServerADZone.Tests.ps1 b/Tests/Unit/MSFT_xDnsServerADZone.Tests.ps1 index dffeb285..3ddc73a4 100644 --- a/Tests/Unit/MSFT_xDnsServerADZone.Tests.ps1 +++ b/Tests/Unit/MSFT_xDnsServerADZone.Tests.ps1 @@ -66,9 +66,12 @@ try Mock -CommandName 'Assert-Module' -MockWith { } - It 'Returns a "System.Collections.Hashtable" object type' { + It 'Returns a "System.Collections.Hashtable" object type with schema properties' { $targetResource = Get-TargetResource @testParams -ReplicationScope $testReplicationScope; $targetResource -is [System.Collections.Hashtable] | Should Be $true; + + $schemaFields = @('Name', 'DynamicUpdate', 'ReplicationScope', 'DirectoryPartitionName', 'Ensure'); + ($Null -eq ($targetResource.Keys.GetEnumerator() | Where-Object -FilterScript { $schemaFields -notcontains $_ })) | Should Be $true; } It 'Returns "Present" when DNS zone exists and "Ensure" = "Present"' { diff --git a/appveyor.yml b/appveyor.yml index a7b65efb..87486a6b 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,42 +1,42 @@ -#---------------------------------# -# environment configuration # -#---------------------------------# +#---------------------------------# +# environment configuration # +#---------------------------------# version: 1.7.{build}.0 -install: - - cinst -y pester +install: - git clone https://github.com/PowerShell/DscResource.Tests - - ps: Push-Location - - cd DscResource.Tests - - ps: Import-Module .\TestHelper.psm1 -force - - ps: Pop-Location - ps: | + Push-Location + cd DscResource.Tests + Import-Module .\TestHelper.psm1 -force + Pop-Location + Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force + Install-Module -Name Pester -Repository PSGallery -Force Add-WindowsFeature RSAT-DNS-Server - -#---------------------------------# -# build configuration # -#---------------------------------# +#---------------------------------# +# build configuration # +#---------------------------------# build: false -#---------------------------------# -# test configuration # -#---------------------------------# +#---------------------------------# +# test configuration # +#---------------------------------# test_script: - ps: | $testResultsFile = ".\TestsResults.xml" $res = Invoke-Pester -OutputFormat NUnitXml -OutputFile $testResultsFile -PassThru (New-Object 'System.Net.WebClient').UploadFile("https://ci.appveyor.com/api/testresults/nunit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path $testResultsFile)) - if ($res.FailedCount -gt 0) { + if ($res.FailedCount -gt 0) { throw "$($res.FailedCount) tests failed." } - -#---------------------------------# -# deployment configuration # -#---------------------------------# -# scripts to run before deployment -deploy_script: +#---------------------------------# +# deployment configuration # +#---------------------------------# + +# scripts to run before deployment +deploy_script: - ps: | # Creating project artifact $stagingDirectory = (Resolve-Path ..).Path @@ -45,22 +45,18 @@ deploy_script: $zipFilePath = Join-Path $stagingDirectory "$(Split-Path $pwd -Leaf).zip" Add-Type -assemblyname System.IO.Compression.FileSystem [System.IO.Compression.ZipFile]::CreateFromDirectory($pwd, $zipFilePath) - + # Creating NuGet package artifact New-Nuspec -packageName $env:APPVEYOR_PROJECT_NAME -version $env:APPVEYOR_BUILD_VERSION -author "Microsoft" -owners "Microsoft" -licenseUrl "https://github.com/PowerShell/DscResources/blob/master/LICENSE" -projectUrl "https://github.com/$($env:APPVEYOR_REPO_NAME)" -packageDescription $env:APPVEYOR_PROJECT_NAME -tags "DesiredStateConfiguration DSC DSCResourceKit" -destinationPath . nuget pack ".\$($env:APPVEYOR_PROJECT_NAME).nuspec" -outputdirectory . $nuGetPackageName = $env:APPVEYOR_PROJECT_NAME + "." + $env:APPVEYOR_BUILD_VERSION + ".nupkg" $nuGetPackagePath = (Get-ChildItem $nuGetPackageName).FullName - + @( # You can add other artifacts here $zipFilePath, $nuGetPackagePath - ) | % { + ) | % { Write-Host "Pushing package $_ as Appveyor artifact" Push-AppveyorArtifact $_ } - - - - diff --git a/xDnsServer.psd1 b/xDnsServer.psd1 index 4213c538..50d6c6ae 100644 --- a/xDnsServer.psd1 +++ b/xDnsServer.psd1 @@ -1,6 +1,6 @@ @{ # Version number of this module. -ModuleVersion = '1.7.0.0' +ModuleVersion = '1.8.0.0' # ID used to uniquely identify this module GUID = '5f70e6a1-f1b2-4ba0-8276-8967d43a7ec2' @@ -47,10 +47,8 @@ PrivateData = @{ # IconUri = '' # ReleaseNotes of this module - ReleaseNotes = '* Unit tests updated to use standard unit test templates. -* MSFT_xDnsServerZoneTransfer: Added unit tests. - Updated to meet Style Guidelines. -* MSFT_xDnsARecord: Removed hard coding of Localhost computer name to eliminate PSSA rule violation. + ReleaseNotes = '* Converted AppVeyor.yml to pull Pester from PSGallery instead of Chocolatey +* Fixed bug in xDnsServerADZone causing Get-TargetResource to fail with an extra property. ' @@ -61,3 +59,4 @@ PrivateData = @{ +