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

DnsClientGlobalSetting: Setting SuffixSearchList to an empty string fails Test-DscConfiguration #398

Closed
X-Guardian opened this issue May 19, 2019 · 2 comments · Fixed by #399
Labels
bug The issue is a bug. in progress The issue is being actively worked on by someone.

Comments

@X-Guardian
Copy link
Contributor

Setting the DnsClientGlobalSetting SuffixSearchList to an empty string fails Test-DscConfiguration

The SuffixSearchList is correctly set to an empty string array, but the test fails. Setting th attribute to an empty array @() instead, works correctly.

The verbose logging error is also not expanding the strings correctly:

DNS Client Global Setting "SuffixSearchList" is "System.String[]" but should be "System.String[]". Change required.

Verbose logs showing the problem

VERBOSE: Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = ApplyConfiguration,'className'
 = MSFT_DSCLocalConfigurationManager,'namespaceName' = root/Microsoft/Windows/DesiredStateConfiguration'.
VERBOSE: An LCM method call arrived from computer WIN-KQV0CSPMTL6 with user sid
S-1-5-21-653353224-2594412442-3194183951-1002.
VERBOSE: [WIN-KQV0CSPMTL6]:                            [] Starting consistency engine.
VERBOSE: [WIN-KQV0CSPMTL6]:                            [] A pending configuration exists. DSC will process a set
request on the pending configuration.
VERBOSE: [WIN-KQV0CSPMTL6]: LCM:  [ Start  Resource ]  [[DnsClientGlobalSetting]SuffixSearchList]
VERBOSE: [WIN-KQV0CSPMTL6]: LCM:  [ Start  Test     ]  [[DnsClientGlobalSetting]SuffixSearchList]
VERBOSE: [WIN-KQV0CSPMTL6]:                            [[DnsClientGlobalSetting]SuffixSearchList] Test-TargetResource:
Testing DNS Client Global Settings.
VERBOSE: [WIN-KQV0CSPMTL6]:                            [[DnsClientGlobalSetting]SuffixSearchList] Test-TargetResource:
DNS Client Global Setting "SuffixSearchList" is "System.String[]" but should be "System.String[]". Change required.
VERBOSE: [WIN-KQV0CSPMTL6]: LCM:  [ End    Test     ]  [[DnsClientGlobalSetting]SuffixSearchList]  in 0.0620 seconds.
VERBOSE: [WIN-KQV0CSPMTL6]: LCM:  [ Start  Set      ]  [[DnsClientGlobalSetting]SuffixSearchList]
VERBOSE: [WIN-KQV0CSPMTL6]:                            [[DnsClientGlobalSetting]SuffixSearchList] Set-TargetResource:
Setting DNS Client Global Settings.
VERBOSE: [WIN-KQV0CSPMTL6]:                            [[DnsClientGlobalSetting]SuffixSearchList] Set-TargetResource:
Setting DNS Client Global Settings parameter SuffixSearchList to "System.String[]".
VERBOSE: [WIN-KQV0CSPMTL6]:                            [[DnsClientGlobalSetting]SuffixSearchList] Set-TargetResource:
Setting DNS Client Global Settings updated.
VERBOSE: [WIN-KQV0CSPMTL6]: LCM:  [ End    Set      ]  [[DnsClientGlobalSetting]SuffixSearchList]  in 0.5560 seconds.
VERBOSE: [WIN-KQV0CSPMTL6]: LCM:  [ End    Resource ]  [[DnsClientGlobalSetting]SuffixSearchList]
VERBOSE: [WIN-KQV0CSPMTL6]:                            [] Consistency check completed.
VERBOSE: Operation 'Invoke CimMethod' complete.
VERBOSE: Time taken for configuration job to complete is 1.007 seconds
VERBOSE: Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = TestConfiguration,'className'
= MSFT_DSCLocalConfigurationManager,'namespaceName' = root/Microsoft/Windows/DesiredStateConfiguration'.
VERBOSE: An LCM method call arrived from computer WIN-KQV0CSPMTL6 with user sid
S-1-5-21-653353224-2594412442-3194183951-1002.
VERBOSE: [WIN-KQV0CSPMTL6]: LCM:  [ Start  Test     ]
VERBOSE: [WIN-KQV0CSPMTL6]: LCM:  [ Start  Resource ]  [[DnsClientGlobalSetting]SuffixSearchList]
VERBOSE: [WIN-KQV0CSPMTL6]: LCM:  [ Start  Test     ]  [[DnsClientGlobalSetting]SuffixSearchList]
VERBOSE: [WIN-KQV0CSPMTL6]:                            [[DnsClientGlobalSetting]SuffixSearchList] Test-TargetResource:
Testing DNS Client Global Settings.
VERBOSE: [WIN-KQV0CSPMTL6]:                            [[DnsClientGlobalSetting]SuffixSearchList] Test-TargetResource:
DNS Client Global Setting "SuffixSearchList" is "System.String[]" but should be "System.String[]". Change required.
VERBOSE: [WIN-KQV0CSPMTL6]: LCM:  [ End    Test     ]  [[DnsClientGlobalSetting]SuffixSearchList] False in 0.0780
seconds.
VERBOSE: [WIN-KQV0CSPMTL6]: LCM:  [ End    Resource ]  [[DnsClientGlobalSetting]SuffixSearchList]
VERBOSE: [WIN-KQV0CSPMTL6]: LCM:  [ End    Test     ]     Completed processing test operation. The operation returned
False.
VERBOSE: [WIN-KQV0CSPMTL6]: LCM:  [ End    Test     ]    in  0.2490 seconds.
VERBOSE: Operation 'Invoke CimMethod' complete.
False
VERBOSE: Time taken for configuration job to complete is 0.76 seconds

Suggested solution to the issue

Looking at the code, Test-TargetResource for DnsClientGlobalSetting is currently being performed in a single foreach loop, even though all four parameters are different types. Suggestion would be to split the test code so that each parameter is tested individually, then specific coding for the SuffixSearchList can be added to cope with this issue.

The DSC configuration that is used to reproduce the issue (as detailed as possible)

Configuration SuffixSearchList
{
    Import-DscResource -Module NetworkingDsc

    Node localhost
    {
        DnsClientGlobalSetting SuffixSearchList
        {
            IsSingleInstance = 'Yes'
            SuffixSearchList = ''
        }
    }
}

. SuffixSearchList

Publish-DscConfiguration .\SuffixSearchList\

Start-DscConfiguration -Wait -Verbose -Force -UseExisting

Test-DscConfiguration -Verbose

The operating system the target node is running

OsName               : Microsoft Windows Server 2019 Standard Evaluation
OsOperatingSystemSKU : 79
OsArchitecture       : 64-bit
WindowsVersion       : 1809
WindowsBuildLabEx    : 17763.1.amd64fre.rs5_release.180914-1434
OsLanguage           : en-US
OsMuiLanguages       : {en-US}

Version and build of PowerShell the target node is running

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

Version of the DSC module that was used ('dev' if using current dev branch)

Networking Dsc v7.2.0.0

@PlagueHO PlagueHO added bug The issue is a bug. help wanted The issue is up for grabs for anyone in the community. in progress The issue is being actively worked on by someone. and removed help wanted The issue is up for grabs for anyone in the community. labels May 21, 2019
@PlagueHO
Copy link
Member

Thanks for raising this @X-Guardian - I've marked this in progress and will review your PR once the tests are passing. Thanks for contributing!

@X-Guardian
Copy link
Contributor Author

Cheers @PlagueHO, all tests are now passing.

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. in progress The issue is being actively worked on by someone.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants