You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Details of the scenario you tried and the problem that is occurring
When defining multiple entries on a single line it will write them to the host file every time the LCM kicks off.
Line 233 -259 takes in account for multiple entries per line but then a compare happens later against that array and a string that was passed into the Get-HostEntry.
Suggested solution to the issue
Change line 368
FROM: if ($result.Host -eq $HostName)
TO: if ([string]$result.Host -eq HostName)
The DSC configuration that is used to reproduce the issue (as detailed as possible)
The hostname variable is a key property and appears to be intended for use with a single hostname value. If it supported multiple hostname entries then it could create a resource state conflict like the following:
There would be no errors generated in the configuration block (or in the case of partials by the LCM when published) because the key properties are unique. Then during execution one resource Test1 would attempt to add a host entry while the second Test2 would work to remove it.
I think the resource needs more checks in place if the intended input is supposed to be limited to a single host. In its current form it handles single host entries correctly and needs to be configured iteratively for each hostname that shares an IPAddress to work properly.
After talking with @39Delta and discovering that every entry after the first is a CNAME I would recommend we add a parameter for CNAME to this resource and not allow multiple entries in the HostName parameter.
test-ocsp-responder
----------------------------------------
Record Name ..... : test-ocsp-responder
Record Type ..... : 1
Time To Live .... : 86400Data Length ..... : 4
Section ....... : Answer
A (Host) Record ... : 192.168.0.252test-ocsp-responder2
----------------------------------------
Record Name ..... : test-ocsp-responder2
Record Type ..... : 5
Time To Live .... : 86400Data Length ..... : 8
Section ....... : Answer
CNAME Record .... : test-ocsp-responder
Details of the scenario you tried and the problem that is occurring
When defining multiple entries on a single line it will write them to the host file every time the LCM kicks off.
Line 233 -259 takes in account for multiple entries per line but then a compare happens later against that array and a string that was passed into the Get-HostEntry.
Suggested solution to the issue
Change line 368
FROM:
if ($result.Host -eq $HostName)
TO:
if ([string]$result.Host -eq HostName)
The DSC configuration that is used to reproduce the issue (as detailed as possible)
The operating system the target node is running
Version and build of PowerShell the target node is running
Version of the DSC module that was used ('dev' if using current dev branch)
6.1.0.0 The code for this issue looks the same.
The text was updated successfully, but these errors were encountered: