dsccommunity / FailoverClusterDsc

This module contains DSC resources for deployment and configuration of Windows Server Failover Cluster.
MIT License
60 stars 54 forks source link

xClusterNetwork: Fails on WS2012 as the Update method doesn't exist #191

Closed codykonior closed 6 years ago

codykonior commented 6 years ago

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

I'm renaming cluster network adapters with this. It renames the network adapter but fails with an error.

This is because in 2012 cluster module the Update method did not exist and was not needed, any change to the object would take effect immediately.

So it works, throws an error, but on the next run passes (because the Test passes and the Set isn't needed again).

It should be fixed though.

Verbose logs showing the problem

VERBOSE: [SEC1N1]:                            [[xClusterNetwork]RenameClusterNetworkC1Heartbeat] Connecting to cluster
on local computer SEC1N1.
Method invocation failed because [Microsoft.FailoverClusters.PowerShell.ClusterNetwork] does not contain a method
named 'Update'.
    + CategoryInfo          : InvalidOperation: (:) [], CimException
    + FullyQualifiedErrorId : MethodNotFound
    + PSComputerName        : SEC1N1

VERBOSE: [SEC1N1]: LCM:  [ End    Set      ]  [[xClusterNetwork]RenameClusterNetworkC1Heartbeat]  in 0.0780 seconds.
The PowerShell DSC resource '[xClusterNetwork]RenameClusterNetworkC1Heartbeat' with SourceInfo
'C:\Lability\Configurations\WS2012.ps1::288::17::xClusterNetwork' threw one or more non-terminating errors while
running the Set-TargetResource functionality. These errors are logged to the ETW channel called
Microsoft-Windows-DSC/Operational. Refer to this channel for more details.
    + CategoryInfo          : InvalidOperation: (:) [], CimException
    + FullyQualifiedErrorId : NonTerminatingErrorFromProvider
    + PSComputerName        : SEC1N1

Suggested solution to the issue

Simply wrap the 3 Update calls in xClusterNetwork like so:

        if ($clusterNetworkResource.psobject.Methods['Update']) {
            $clusterNetworkResource.Update()
        }

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

                xClusterNetwork "RenameClusterNetwork$($cluster.Name)Heartbeat" {
                    Address = $clusterIgnoreNetwork.NetworkID
                    AddressMask = $clusterIgnoreNetwork.SubnetMask
                    Name = $clusterIgnoreNetwork.Name
                    Role = 1 # Heartbeat Only

                    DependsOn = "[xCluster]AddNodeToCluster$($cluster.Name)"
                }

The operating system the target node is running

Windows Server 2012

Version and build of PowerShell the target node is running

WMF 5.1

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

dev