Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
XabiBeltza opened this issue Jun 28, 2021 · 1 comment
Open

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

XabiBeltza opened this issue Jun 28, 2021 · 1 comment
Labels
bug The issue is a bug. help wanted The issue is up for grabs for anyone in the community.

Comments

@XabiBeltza
Copy link

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
@johlju johlju added bug The issue is a bug. help wanted The issue is up for grabs for anyone in the community. labels Jun 29, 2021
@johlju
Copy link
Member

johlju commented Jun 29, 2021

Thanks for reporting this! Happy to review a PR that solves this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The issue is a bug. help wanted The issue is up for grabs for anyone in the community.
Projects
None yet
Development

No branches or pull requests

2 participants