Skip to content

DnsRecordCname doesn't find record when target ends with '.' #266

Open
@XabiBeltza

Description

@XabiBeltza

Problem description

When putting a full FQDN value on property HostNameAlias, the Test function is not able to find an existing record.

Verbose logs

"[OBFUSCATED]:                            [[DnsRecordCname]DirectResourceAccess] A matching DNS resource record not found.",
"[OBFUSCATED]:                            [[DnsRecordCname]DirectResourceAccess] DNS record property 'Ensure' is not correct. Expected 'Present', actual 'Absent'.",
"[OBFUSCATED]:                            [[DnsRecordCname]DirectResourceAccess] DNS record is NOT in the desired state.",
"[OBFUSCATED]: LCM:  [ End    Test     ]  [[DnsRecordCname]DirectResourceAccess] False in 4.7190 seconds."

DSC configuration

DnsRecordCname 'alias'
        {
            Name   = 'alias'
            HostNameAlias = 'desiredfqdn.zonename.com.'
            ZoneName = 'zonename.local'
            Ensure = 'Present'
            DnsServer = 'obfuscated.zonename.local'
        }

Suggested solution

I think the issue is in line 57 of source/Classes/002.DnsRecordCname.ps1. The filter adds a '.' to the property HostNameAlias:
$_.RecordData.HostNameAlias -eq "$($this.HostnameAlias).
This makes the filter skip the good record.
The solution could be: determining first if the variable 'HostNameAlias' already is a proper FQDN with a dot in the end.

Operating system the target node is running

OsName               : Microsoft Windows 10 Pro
OsOperatingSystemSKU : 48
OsArchitecture       : 64-bit
WindowsVersion       : 2004
WindowsBuildLabEx    : 19041.1.amd64fre.vb_release.191206-1406
OsLanguage           : en-US
OsMuiLanguages       : {en-US}

PowerShell version and build the target node is running

Name                           Value
----                           -----
PSVersion                      5.1.19041.1023
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.19041.1023
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

DnsServerDsc version

Name         Version Path
----         ------- ----
DnsServerDsc 3.0.0   C:\Program Files\WindowsPowerShell\Modules\DnsServerDsc\3.0.0\DnsServerDsc.psd1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThe issue is a bug.help wantedThe issue is up for grabs for anyone in the community.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions