From c7d1831b9febeff2844bebe8e41a3c24cea2ec16 Mon Sep 17 00:00:00 2001 From: Katie Keim Date: Wed, 22 Jun 2016 17:39:56 -0700 Subject: [PATCH 1/6] Added new MS code of conduct --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 98628698..7dea9e8a 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). From 6ea8a60d8a502e12e4494e48998c76095690e166 Mon Sep 17 00:00:00 2001 From: Daniel Scott-Raynsford Date: Sat, 2 Jul 2016 17:05:01 +1200 Subject: [PATCH 2/6] Converted AppVeyor.yml to pull Pester from PSGallery instead of Chocolatey --- README.md | 34 ++++++++++++++++--------------- appveyor.yml | 56 +++++++++++++++++++++++++--------------------------- 2 files changed, 45 insertions(+), 45 deletions(-) diff --git a/README.md b/README.md index 7dea9e8a..d69e4082 100644 --- a/README.md +++ b/README.md @@ -62,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. @@ -85,6 +85,8 @@ Values include: { ARecord | CName } ### Unreleased +* Converted AppVeyor.yml to pull Pester from PSGallery instead of Chocolatey + ### 1.7.0.0 * Unit tests updated to use standard unit test templates. @@ -124,7 +126,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** @@ -234,19 +236,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 @@ -265,13 +267,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 @@ -284,12 +286,12 @@ configuration Sample_Arecord { Name = "testArecord" Target = "192.168.0.123" - Zone = "contoso.com" + Zone = "contoso.com" Type = "ARecord" Ensure = "Present" } } -Sample_Arecord +Sample_Arecord ``` ### Adding round-robin DNS ARecords @@ -302,7 +304,7 @@ configuration Sample_RoundRobin_Arecord { Name = "testArecord" Target = "192.168.0.123" - Zone = "contoso.com" + Zone = "contoso.com" Type = "ARecord" Ensure = "Present" } @@ -310,13 +312,13 @@ configuration Sample_RoundRobin_Arecord { Name = "testArecord" Target = "192.168.0.124" - Zone = "contoso.com" + Zone = "contoso.com" Type = "ARecord" Ensure = "Present" } } -Sample_RoundRobin_Arecord +Sample_RoundRobin_Arecord ``` ### Adding a DNS CName @@ -329,12 +331,12 @@ configuration Sample_CName { Name = "testCName" Target = "test.contoso.com" - Zone = "contoso.com" + Zone = "contoso.com" Type = "CName" Ensure = "Present" } } -Sample_Crecord +Sample_Crecord ``` ### Removing a DNS A Record @@ -349,7 +351,7 @@ configuration Sample_Remove_Record Target = "192.168.0.123" Zone = "contoso.com" Type = "ARecord" - Ensure = "Absent" + Ensure = "Absent" } } Sample_Sample_Remove_Record diff --git a/appveyor.yml b/appveyor.yml index a7b65efb..cf0a3e6c 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,42 +1,40 @@ -#---------------------------------# -# environment configuration # -#---------------------------------# +#---------------------------------# +# environment configuration # +#---------------------------------# version: 1.7.{build}.0 -install: - - cinst -y pester - - 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 +43,22 @@ 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 $_ } - - + + From 46383125b808ee304a42d202fcf8c941800a26d8 Mon Sep 17 00:00:00 2001 From: Daniel Scott-Raynsford Date: Sat, 2 Jul 2016 17:08:21 +1200 Subject: [PATCH 3/6] Fix AppVeyor.yml --- appveyor.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index cf0a3e6c..472de198 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -58,7 +58,3 @@ deploy_script: Write-Host "Pushing package $_ as Appveyor artifact" Push-AppveyorArtifact $_ } - - - - From 68f13cd856b6dd408fb0bdd5098d9e1b022961b8 Mon Sep 17 00:00:00 2001 From: Daniel Scott-Raynsford Date: Sat, 2 Jul 2016 17:09:50 +1200 Subject: [PATCH 4/6] Fix AppVeyor.yml --- appveyor.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/appveyor.yml b/appveyor.yml index 472de198..87486a6b 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -2,6 +2,8 @@ # environment configuration # #---------------------------------# version: 1.7.{build}.0 +install: + - git clone https://github.com/PowerShell/DscResource.Tests - ps: | Push-Location cd DscResource.Tests From b44e201b07a98400a845afe6d13ac9705c22fc74 Mon Sep 17 00:00:00 2001 From: Bernie White Date: Wed, 9 Aug 2017 10:08:04 +1000 Subject: [PATCH 5/6] xDnsServerADZone: Removed CimSession from Get-TargetResource return value (Fixes #40) (#49) * Fixed issue with xDnsServerADZone Get-TargetResource returning extra property. Fixes PowerShell/xDnsServer#40 * Updated unit tests to confirm only schema fields are returned. PowerShell/xDnsServer#40 * Fix failing readme.md with tabs instead of spaces --- .../MSFT_xDnsServerADZone.psm1 | 1 - README.md | 13 +++++++------ Tests/Unit/MSFT_xDnsServerADZone.Tests.ps1 | 5 ++++- 3 files changed, 11 insertions(+), 8 deletions(-) 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 d69e4082..210f187a 100644 --- a/README.md +++ b/README.md @@ -86,6 +86,7 @@ Values include: { ARecord | CName } ### Unreleased * 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 @@ -140,7 +141,7 @@ configuration Sample_Set_Forwarders Import-DscResource -module xDnsServer xDnsServerForwarder SetForwarders { - IsSingleInstance = 'Yes' + IsSingleInstance = 'Yes' IPAddresses = '192.168.0.10','192.168.0.11' } } @@ -287,7 +288,7 @@ configuration Sample_Arecord Name = "testArecord" Target = "192.168.0.123" Zone = "contoso.com" - Type = "ARecord" + Type = "ARecord" Ensure = "Present" } } @@ -305,7 +306,7 @@ configuration Sample_RoundRobin_Arecord Name = "testArecord" Target = "192.168.0.123" Zone = "contoso.com" - Type = "ARecord" + Type = "ARecord" Ensure = "Present" } xDnsRecord TestRecord2 @@ -313,7 +314,7 @@ configuration Sample_RoundRobin_Arecord Name = "testArecord" Target = "192.168.0.124" Zone = "contoso.com" - Type = "ARecord" + Type = "ARecord" Ensure = "Present" } @@ -332,7 +333,7 @@ configuration Sample_CName Name = "testCName" Target = "test.contoso.com" Zone = "contoso.com" - Type = "CName" + Type = "CName" Ensure = "Present" } } @@ -350,7 +351,7 @@ configuration Sample_Remove_Record Name = "testArecord" Target = "192.168.0.123" Zone = "contoso.com" - Type = "ARecord" + Type = "ARecord" Ensure = "Absent" } } 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"' { From 369805473921a119f33060a6aebff6a13c01ddf3 Mon Sep 17 00:00:00 2001 From: Katie Keim Date: Wed, 23 Aug 2017 12:35:53 -0700 Subject: [PATCH 6/6] Releasing version 1.8.0.0 --- README.md | 2 ++ xDnsServer.psd1 | 9 ++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 210f187a..cb6c3584 100644 --- a/README.md +++ b/README.md @@ -85,6 +85,8 @@ 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. 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 = @{ +