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

DFSReplicationGroupMembership: Fails when trying to create a new DFS group and running Test first #125

Closed
Borgquite opened this issue Oct 10, 2022 · 0 comments · Fixed by #126

Comments

@Borgquite
Copy link
Contributor

Borgquite commented Oct 10, 2022

Problem description

If the DFSReplicationGroupMembership is used on a new setup where the replication group does not yet exist with the Test-TargetResource executed before the configuration is applied for the first time, it will fail with 'System.InvalidOperationException: DFS Replication Group "" folder "" on "" is missing.'

Verbose logs

VERBOSE: [Test-VM]: LCM:  [ Start  Resource ]  [DFSReplicationGroupMembership]RGPublicSoftwareFS1
VERBOSE: [Test-VM]: LCM:  [ Start  Test     ]  [DFSReplicationGroupMembership]RGPublicSoftwareFS1
VERBOSE: [Test-VM]:                            [DFSReplicationGroupMembership]RGPublicSoftwareFS1 Test-TargetResource: Testing DFS Replication Group "DC 'Programs' Share"
folder "Folder" on "Test-VM.ad.mafint.org".
VERBOSE: [Test-VM]: LCM:  [ End    Test     ]  [DFSReplicationGroupMembership]RGPublicSoftwareFS1 False in 0.0620 seconds.
VERBOSE: [Test-VM]: LCM:  [ *FAILED*Compare  ]     Completed processing compare operation. The operation returned
False.
PowerShell DSC resource DSC_DFSReplicationGroupMembership  failed to execute Test-TargetResource functionality with
error message: System.InvalidOperationException: DFS Replication Group "DFS Replication Group" folder "Folder" on
"Test-VM.test.domain" is missing.
    + CategoryInfo          : InvalidOperation: (root/Microsoft/...gurationManager:String) [], CimException
    + FullyQualifiedErrorId : ProviderOperationExecutionFailure
    + PSComputerName        : Test-VM

DSC configuration

DFSReplicationGroup RGPublic
{
	GroupName = 'DFS Replication Group'
	Description = 'Public files for use by all departments'
	Ensure = 'Present'
	Members = 'FileServer1','FileServer2'
	Folders = 'Folder'
	Topology = 'Fullmesh'
	PSDSCRunAsCredential = $Credential
}

DFSReplicationGroupFolder RGSoftwareFolder
{
	GroupName = 'DFS Replication Group'
	FolderName = 'Folder'
	Description = 'DFS Share for storing software installers'
	DirectoryNameToExclude = 'Temp'
	PSDSCRunAsCredential = $Credential
	DependsOn = '[DFSReplicationGroup]RGPublic'
}

DFSReplicationGroupMembership RGPublicSoftwareFS1
{
	GroupName = 'DFS Replication Group'
	FolderName = 'Folder'
	ComputerName = 'FileServer1'
	ContentPath = 'd:\Public\Software'
	StagingPathQuotaInMB = 4096
	PrimaryMember = $true
	PSDSCRunAsCredential = $Credential
	DependsOn = '[DFSReplicationGroupFolder]RGSoftwareFolder'
} # End of RGPublicSoftwareFS1 Resource

DFSReplicationGroupMembership RGPublicSoftwareFS2
{
	GroupName = 'DFS Replication Group'
	FolderName = 'Folder'
	ComputerName = 'FileServer2'
	ContentPath = 'e:\Data\Public\Folder'
	StagingPathQuotaInMB = 4096
	PSDSCRunAsCredential = $Credential
	DependsOn = '[DFSReplicationGroupFolder]RGSoftwareFolder'
}

Suggested solution

The DFSReplicationGroupMembership resource does not need to return a terminating error when the specifed replication group folder membership does not exist - instead, it should just return that the resource is not in the desired state. There is no need to tank the entire Test-TargetResource process.

Operating system the target node is running

OsName               : Microsoft Windows Server 2022 Datacenter Azure Edition
OsOperatingSystemSKU : 407
OsArchitecture       : 64-bit
WindowsVersion       : 2009
WindowsBuildLabEx    : 20348.1.amd64fre.fe_release.210507-1500
OsLanguage           : en-US
OsMuiLanguages       : {en-US}

PowerShell version and build the target node is running

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

DFSDsc version

Name   Version Path
----   ------- ----
DFSDsc 4.5.0   C:\Program Files\WindowsPowerShell\Modules\DFSDsc\4.5.0\DFSDsc.psd1
Borgquite added a commit to Borgquite/DFSDsc that referenced this issue Oct 17, 2022
Borgquite added a commit to Borgquite/DFSDsc that referenced this issue Oct 21, 2022
PlagueHO pushed a commit that referenced this issue Aug 3, 2023
 - Add support for setting a DFS Namespace root target's referral status (state) to be either Online or Offline
   in MSFT_DFSNamespaceRoot. State is now a required parameter.
 - Add support for setting a DFS Namespace folder target's referral status (state) to be either Online or Offline
   in MSFT_DFSNamespaceFolder. State is now a required parameter.
 - Update examples to support new required parameter.

* Fixes the description of the Example 1 for DFSNamespaceFolder and DFSNamespaceRoot.

* Fixes a typo in Example 1 for DFSNamespaceFolder and DFSNamespaceRoot examples.

* Add DFSReplicationGroupMember to define members separate from a group

* Add DFSReplicationGroupMember tests

* Allow Get-TargetResource & Test-TargetResource when replication group does not exist (fix #125)

* Add support for CrossFileRDCEnabled, MinimumRDCFileSizeInKB in DSC_DFSReplicationGroupConnection plus EnsureEnabled, MinimumFileStagingSize, ConflictAndDeletedQuotaInMB, RemoveDeletedFiles and DfsnPath in DFSReplicationGroupMembership

* Add tests for new parameters in DFSReplicationGroupConnections

* Add tests for new parameters in DFSReplicationGroupMembership

* Add new strings for DFSReplicationGroupMembership

* Convert all 'Ensure' parameters to default to 'Present' #29

* Spelling corrections

* Correction to (copied?) comment referencing incorrect file

* Merge branch 'bsmall_referral_status_support'

* Merge branch 'wayfair-contribs-bsmall_referral_status_support' into patch-1

* Fix ReplicationGroup integration tests testing for Namespace feature

* Rename 'State' to 'TargetState' to avoid clash with existing 'State' property, make it optional (to avoid breaking change)

* Finalise above change

* Update examples to use TargetState instead of State

* Revert error

* TargetState integration tests for DFSNamespaceRoot

* Fix whitespace

* TargetState unit tests for DFSNamespaceFolder and DFSNamespaceRoot

* Fix DFSReplicationGroupConnection EnsureRDCEnabled test

* Fix tests to increment instead of using fixed values

* Updated CHANGELOG

* Fix error in CHANGELOG

* Another CHANGELOG fix

* Add 'State' back into DFSNamespaceRoot Schema

* Fix Set-TargetResource check for TargetState

* Update DFSReplicationGroup tests as now the Members attribute can be blank for use with DFSReplicationGroupMember

* Update DFSReplicationGroup tests as now the Members attribute can be blank (2)

* Revert ability to leave Folders blank too (breaks tests)

* Fix DFSReplicationGroup test, (spelling mistake)

* DFSReplicationGroupFolder and DFSReplicationGroupMembership should not fail on do not exist (update test for #125)

* Fix bugs in DFSReplicationGroupMember tests

* Update CHANGELOG

* Separate change log entries into sections for each resource

* New ReplicationGroup sample, fixes to TargetState descriptions

* Pin build image to Ubuntu 20.04 - fixes #127

* Changelog tweaks

* DFSReplicationGroup fixes - additional Member warnings, fix for empty $Members array

* DFSReplicationGroupMember warning

* Fixed example

* Replace 2016-Datacenter,2016-Datacenter-Server-Core with 2019-Datacenter,2019-Datacenter-Server-Core (all examples)

* DFSReplicationGroup example Members warning

* More DFSReplicationGroup / DFSReplicationGroupMember example fixes

* Replace -Be [$true/$false/$null] with -BeTrue -BeFalse -BeNullOrEmpty

* Remove unnecessary 'Offline' from examples

* Revert $Members change - fix texts

* Grammatical error

* Support clearing out members from a replication group

* Attempt to fix DFSReplicationGroup tests - 'no members'

* Same fix for no Members for ContentPaths

* Same fix as Null Members for Null Folders in tests

Co-Authored-By: Ben Small <bsmall@wayfair.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant