Skip to content

Commit

Permalink
Merge pull request #52 from PowerShell/dev
Browse files Browse the repository at this point in the history
Release of version 1.8.0.0 of xDnsServer
  • Loading branch information
kwirkykat authored Aug 23, 2017
2 parents 3056555 + 3698054 commit a95f3c9
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 59 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
52 changes: 30 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 [[email protected]](mailto:[email protected]) 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).

Expand Down Expand Up @@ -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.

Expand All @@ -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.
Expand Down Expand Up @@ -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**

Expand All @@ -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'
}
}
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
5 changes: 4 additions & 1 deletion Tests/Unit/MSFT_xDnsServerADZone.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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"' {
Expand Down
56 changes: 26 additions & 30 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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 $_
}
9 changes: 4 additions & 5 deletions xDnsServer.psd1
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -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.
'

Expand All @@ -61,3 +59,4 @@ PrivateData = @{




0 comments on commit a95f3c9

Please sign in to comment.