dsccommunity / UpdateServicesDsc

This module contains community maintained DSC resources for deployment and configuration of Windows Server Update Services.
MIT License
31 stars 27 forks source link

[UpdateServicesServer] Upstream Server triggers reconfigure when not specified #55

Open CraigTolley opened 4 years ago

CraigTolley commented 4 years ago

Details of the scenario you tried and the problem that is occurring

Configured WSUS using DSC. SCCM then used the configured instance, and set the Upstream Server. Expected that DSC would ignore this as the option is not specified in the declared configuration. Found that DSC performed a reconfigure of WSUS back to Microsoft Update. SCCM then reconfigured again, and we went round in a circle.

Verbose logs showing the problem

[[UpdateServicesServer]SccmCasHa-WsusConfig::[SccmCasHa]xSccmCasHa] Upstream Server Name test failed

Suggested solution to the issue

Only return $false from Test Resource if the Upstream Server Name does not match the current server name, and the UpstreamServerName option has been specified in the declared configuration.

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

    UpdateServicesServer SccmCasHa-WsusConfig {
        Ensure = "Present"
        ContentDir = $WsusContentDir
        SqlServer = $WsusSqlInstance
        SetupCredential = $WsusSqlInstanceAdmin
        UpdateImprovementProgram = $false
        DependsOn = @(
            "[WindowsFeature]SccmCasHa-WsusServicesSql",
            "[WindowsFeature]SccmCasHa-WsusServices"
        )
    }

The operating system the target node is running

OsName : Microsoft Windows Server 2016 Standard OsOperatingSystemSKU : StandardServerEdition OsArchitecture : 64-bit WindowsBuildLabEx : 14393.3630.amd64fre.rs1_release.200407-1730 OsLanguage : en-US OsMuiLanguages : {en-US}

Version and build of PowerShell the target node is running

Name Value


PSVersion 5.1.14393.3471 PSEdition Desktop PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...} BuildVersion 10.0.14393.3471 CLRVersion 4.0.30319.42000 WSManStackVersion 3.0 PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1

Version of the DSC module that was used

1.2.1

CraigTolley commented 4 years ago

This solution may present a problem. I wonder if there needs to be an additional parameter, to choose the upstream server type of MicrosoftUpdate, Defined, Ignore? If not this solution would stop monitoring the upstream server for configurations where it is not defined - which would potentially be undesirable.

So a new parameter of: UpstreamServerConfig Options: MicrosoftUpdate Defined Ignored

CraigTolley commented 4 years ago

Proposed PR goes for allowing the UpstreamServerName option to be set to IGNORE, which is then checked against in the Test-TargetResource function.

This option required the least code change, did not add in other parameters and does not introduce a breaking change.

gaelcolas commented 4 years ago

Sorry, I missed that. Will read this tomorrow, that will probably answer my questions on the PR