Skip to content

Commit ab2d16d

Browse files
authored
Fix issue with DnsRecordCname resource when HostNameAlias not ends with '.' #266 (#298)
1 parent ddbed52 commit ab2d16d

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
5656
- Use `New-ArgumentException` instead of `New-InvalidArgumentException`.
5757
- DSC_DnsServerClientSubnet
5858
- Fixed wrong SYNAPSIS.
59+
- DnsRecordCname
60+
- Fixed bug with dot at the end [[Issue #266](https://github.com/dsccommunity/DnsServerDsc/issues/266)].
5961
- DnsRecordA
6062
- Fixed [[Issue #281](https://github.com/dsccommunity/DnsServerDsc/issues/281)].
6163
- Pester tests

source/Classes/020.DnsRecordCname.ps1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ class DnsRecordCname : DnsRecordBase
5959
}
6060

6161
$record = Get-DnsServerResourceRecord @dnsParameters -ErrorAction SilentlyContinue | Where-Object -FilterScript {
62-
$_.RecordData.HostNameAlias -eq "$($this.HostnameAlias)."
62+
# Ensure that HostNameAlias we using for filtering contains precisely one dot at the end.
63+
$_.RecordData.HostNameAlias -eq $($this.HostNameAlias.Trim('.') + '.')
6364
}
6465

6566
return $record

0 commit comments

Comments
 (0)