Skip to content

Commit 89db2ba

Browse files
BorgquiteBen Small
and
Ben Small
authored
BREAKING CHANGE:
- 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 <[email protected]>
1 parent 183c084 commit 89db2ba

File tree

63 files changed

+2421
-453
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+2421
-453
lines changed

CHANGELOG.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
### Changed
99

10+
- DFSNamespaceRoot
11+
- Added support for setting target referral status (TargetState) - fixes [Issue #96](https://github.com/dsccommunity/DFSDsc/issues/96).
12+
- Converted 'Ensure' parameters to default to 'Present' - fixes [Issue #29](https://github.com/dsccommunity/DFSDsc/issues/29).
13+
- DFSNamespaceFolder
14+
- Added support for setting target referral status (TargetState) - fixes [Issue #96](https://github.com/dsccommunity/DFSDsc/issues/96).
15+
- Converted 'Ensure' parameters to default to 'Present' - fixes [Issue #29](https://github.com/dsccommunity/DFSDsc/issues/29).
16+
- DFSReplicationGroup
17+
- Converted 'Ensure' parameters to default to 'Present' - fixes [Issue #29](https://github.com/dsccommunity/DFSDsc/issues/29).
18+
- DFSReplicationGroupMember
19+
- New module allowing replication group members to be separately defined outside of DFSReplicationGroup.
20+
This allows situations where new memberships may be added separately on individual servers, instead of a single server.
21+
- DFSReplicationGroupConnection
22+
- Add support for setting CrossFileRDCEnabled and MinimumRDCFileSizeInKB.
23+
- Converted 'Ensure' parameters to default to 'Present' - fixes [Issue #29](https://github.com/dsccommunity/DFSDsc/issues/29).
24+
- DFSReplicationGroupFolder
25+
- Allow Get-TargetResource and Test-TargetResource to run if group does not exist - fixes [Issue #125](https://github.com/dsccommunity/DFSDsc/issues/125).
26+
- DFSReplicationGroupMembership
27+
- Add support for setting EnsureEnabled, MinimumFileStagingSize, ConflictAndDeletedQuotaInMB, RemoveDeletedFiles and DfsnPath.
28+
- Allow Get-TargetResource and Test-TargetResource to run if group does not exist - fixes [Issue #125](https://github.com/dsccommunity/DFSDsc/issues/125).
1029
- BREAKING CHANGE: Changed resource prefix from MSFT to DSC.
1130
- Updated to use continuous delivery pattern using Azure DevOps - fixes
1231
[Issue #41](https://github.com/dsccommunity/DFSDsc/issues/98).
@@ -39,6 +58,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3958
images - Fixes [Issue #122](https://github.com/dsccommunity/DFSDsc/issues/122).
4059
- Updated pipeline unit tests and integration tests to use Windows Server 2019 and
4160
Windows Server 2022 images - Fixes [Issue #122](https://github.com/dsccommunity/DFSDsc/issues/122).
61+
- Temporarily pinned build image to Ubuntu 20.04 - Fixes [Issue #127](https://github.com/dsccommunity/DFSDsc/issues/127).
4262

4363
### Fixed
4464

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ The **DFSDsc** module contains the following resources:
4646
Create, edit and remove DFS Replication Group connections.
4747
- **[DFSReplicationGroupFolder](https://github.com/PowerShell/DFSDsc/wiki/DFSReplicationGroupFolder)**:
4848
Configure DFS Replication Group folders.
49+
- **[DFSReplicationGroupMember](https://github.com/PowerShell/DFSDsc/wiki/DFSReplicationGroupMember)**:
50+
Configure Replication Group Folder Members.
4951
- **[DFSReplicationGroupMembership](https://github.com/PowerShell/DFSDsc/wiki/DFSReplicationGroupMembership)**:
5052
Configure Replication Group Folder Membership.
5153

azure-pipelines.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ stages:
2424
- job: Package_Module
2525
displayName: 'Package Module'
2626
pool:
27-
vmImage: 'ubuntu-latest'
27+
vmImage: 'ubuntu-20.04'
2828
steps:
2929
- pwsh: |
3030
dotnet tool install --global GitVersion.Tool

source/DFSDsc.psd1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
'DFSReplicationGroup',
4747
'DFSReplicationGroupConnection',
4848
'DFSReplicationGroupFolder',
49+
'DFSReplicationGroupMember',
4950
'DFSReplicationGroupMembership'
5051
)
5152

source/DSCResources/DSC_DFSNamespaceFolder/DSC_DFSNamespaceFolder.psm1

Lines changed: 52 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ $script:localizedData = Get-LocalizedData -DefaultUICulture 'en-US'
1818
1919
.PARAMETER Ensure
2020
Specifies if the DFS Namespace root should exist.
21+
22+
.PARAMETER TargetState
23+
Specifies the state of the DFS namespace folder target.
2124
#>
2225
function Get-TargetResource
2326
{
@@ -33,10 +36,15 @@ function Get-TargetResource
3336
[System.String]
3437
$TargetPath,
3538

36-
[Parameter(Mandatory = $true)]
39+
[Parameter()]
3740
[ValidateSet('Present','Absent')]
3841
[System.String]
39-
$Ensure
42+
$Ensure = 'Present',
43+
44+
[Parameter()]
45+
[ValidateSet('Offline','Online')]
46+
[System.String]
47+
$TargetState = 'Online'
4048
)
4149

4250
Write-Verbose -Message ( @(
@@ -96,6 +104,7 @@ function Get-TargetResource
96104
$returnValue += @{
97105
ReferralPriorityClass = $targetFolder.ReferralPriorityClass
98106
ReferralPriorityRank = $targetFolder.ReferralPriorityRank
107+
TargetState = $targetFolder.State
99108
}
100109

101110
Write-Verbose -Message ( @(
@@ -130,6 +139,9 @@ function Get-TargetResource
130139
.PARAMETER Ensure
131140
Specifies if the DFS Namespace root should exist.
132141
142+
.PARAMETER TargetState
143+
Specifies the state of the DFS namespace folder target.
144+
133145
.PARAMETER Description
134146
The description of the DFS Namespace.
135147
@@ -161,10 +173,15 @@ function Set-TargetResource
161173
[System.String]
162174
$TargetPath,
163175

164-
[Parameter(Mandatory = $true)]
176+
[Parameter()]
165177
[ValidateSet('Present','Absent')]
166178
[System.String]
167-
$Ensure,
179+
$Ensure = 'Present',
180+
181+
[Parameter()]
182+
[ValidateSet('Offline','Online')]
183+
[System.String]
184+
$TargetState = 'Online',
168185

169186
[Parameter()]
170187
[System.String]
@@ -212,7 +229,7 @@ function Set-TargetResource
212229

213230
# The Folder properties that will be updated
214231
$folderProperties = @{
215-
State = 'online'
232+
State = 'Online'
216233
}
217234

218235
if (($Description) `
@@ -280,6 +297,15 @@ function Set-TargetResource
280297
$targetProperties = @{}
281298

282299
# Check the target properties
300+
if (($TargetState) `
301+
-and ($targetFolder.State -ne $TargetState))
302+
{
303+
$targetProperties += @{
304+
State = $TargetState
305+
}
306+
$targetChange = $true
307+
}
308+
283309
if (($ReferralPriorityClass) `
284310
-and ($targetFolder.ReferralPriorityClass -ne $ReferralPriorityClass))
285311
{
@@ -399,6 +425,9 @@ function Set-TargetResource
399425
.PARAMETER Ensure
400426
Specifies if the DFS Namespace root should exist.
401427
428+
.PARAMETER TargetState
429+
Specifies the state of the DFS namespace folder target.
430+
402431
.PARAMETER Description
403432
The description of the DFS Namespace.
404433
@@ -431,10 +460,15 @@ function Test-TargetResource
431460
[System.String]
432461
$TargetPath,
433462

434-
[Parameter(Mandatory = $true)]
463+
[Parameter()]
435464
[ValidateSet('Present','Absent')]
436465
[System.String]
437-
$Ensure,
466+
$Ensure = 'Present',
467+
468+
[Parameter()]
469+
[ValidateSet('Offline','Online')]
470+
[System.String]
471+
$TargetState = 'Online',
438472

439473
[Parameter()]
440474
[System.String]
@@ -533,6 +567,17 @@ function Test-TargetResource
533567

534568
if ($targetFolder)
535569
{
570+
if (($TargetState) `
571+
-and ($targetFolder.State -ne $TargetState))
572+
{
573+
Write-Verbose -Message ( @(
574+
"$($MyInvocation.MyCommand): "
575+
$($LocalizedData.NamespaceFolderTargetParameterNeedsUpdateMessage) `
576+
-f $Path,$TargetPath,'TargetState'
577+
) -join '' )
578+
$desiredConfigurationMatch = $false
579+
}
580+
536581
if (($ReferralPriorityClass) `
537582
-and ($targetFolder.ReferralPriorityClass -ne $ReferralPriorityClass))
538583
{

source/DSCResources/DSC_DFSNamespaceFolder/DSC_DFSNamespaceFolder.schema.mof

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ class DSC_DFSNamespaceFolder : OMI_BaseResource
33
{
44
[Key, Description("Specifies a path for the root of a DFS namespace.")] String Path;
55
[Key, Description("Specifies a path for a root target of the DFS namespace.")] String TargetPath;
6-
[Required, Description("Specifies if the DFS Namespace root should exist."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure;
6+
[Write, Description("Specifies if the DFS Namespace root should exist."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure;
7+
[Write, Description("Specifies the state of the DFS namespace folder target."), ValueMap{"Offline","Online"}, Values{"Offline","Online"}] String TargetState;
78
[Write, Description("The description of the DFS Namespace.")] String Description;
89
[Write, Description("Indicates whether a DFS namespace server provides a client only with referrals that are in the same site as the client.")] Boolean EnableInsiteReferrals;
910
[Write, Description("Indicates whether a DFS namespace uses target failback.")] Boolean EnableTargetFailback;

source/DSCResources/DSC_DFSNamespaceRoot/DSC_DFSNamespaceRoot.psm1

Lines changed: 52 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ $script:localizedData = Get-LocalizedData -DefaultUICulture 'en-US'
1919
.PARAMETER Ensure
2020
Specifies if the DFS Namespace root should exist.
2121
22+
.PARAMETER TargetState
23+
Specifies the state of the DFS namespace root target.
24+
2225
.PARAMETER Type
2326
Specifies the type of a DFS namespace as a Type object.
2427
#>
@@ -36,10 +39,15 @@ function Get-TargetResource
3639
[System.String]
3740
$TargetPath,
3841

39-
[Parameter(Mandatory = $true)]
42+
[Parameter()]
4043
[ValidateSet('Present','Absent')]
4144
[System.String]
42-
$Ensure,
45+
$Ensure = 'Present',
46+
47+
[Parameter()]
48+
[ValidateSet('Offline','Online')]
49+
[System.String]
50+
$TargetState = 'Online',
4351

4452
[Parameter(Mandatory = $true)]
4553
[ValidateSet('Standalone','DomainV1','DomainV2')]
@@ -108,6 +116,7 @@ function Get-TargetResource
108116
$returnValue += @{
109117
ReferralPriorityClass = $target.ReferralPriorityClass
110118
ReferralPriorityRank = $target.ReferralPriorityRank
119+
TargetState = $target.State
111120
}
112121

113122
Write-Verbose -Message ( @(
@@ -142,6 +151,9 @@ function Get-TargetResource
142151
.PARAMETER Ensure
143152
Specifies if the DFS Namespace root should exist.
144153
154+
.PARAMETER TargetState
155+
Specifies the state of the DFS namespace root target.
156+
145157
.PARAMETER Type
146158
Specifies the type of a DFS namespace as a Type object.
147159
@@ -185,10 +197,15 @@ function Set-TargetResource
185197
[System.String]
186198
$TargetPath,
187199

188-
[Parameter(Mandatory = $true)]
200+
[Parameter()]
189201
[ValidateSet('Present','Absent')]
190202
[System.String]
191-
$Ensure,
203+
$Ensure = 'Present',
204+
205+
[Parameter()]
206+
[ValidateSet('Offline','Online')]
207+
[System.String]
208+
$TargetState = 'Online',
192209

193210
[Parameter(Mandatory = $true)]
194211
[ValidateSet('Standalone','DomainV1','DomainV2')]
@@ -253,7 +270,7 @@ function Set-TargetResource
253270

254271
# The root properties that will be updated
255272
$rootProperties = @{
256-
State = 'online'
273+
State = 'Online'
257274
}
258275

259276
if (($Description) `
@@ -348,6 +365,15 @@ function Set-TargetResource
348365
$targetProperties = @{}
349366

350367
# Check the target properties
368+
if (($TargetState) `
369+
-and ($target.State -ne $TargetState))
370+
{
371+
$targetProperties += @{
372+
State = $TargetState
373+
}
374+
$targetChange = $true
375+
} # if
376+
351377
if (($ReferralPriorityClass) `
352378
-and ($target.ReferralPriorityClass -ne $ReferralPriorityClass))
353379
{
@@ -468,6 +494,9 @@ function Set-TargetResource
468494
.PARAMETER Ensure
469495
Specifies if the DFS Namespace root should exist.
470496
497+
.PARAMETER TargetState
498+
Specifies the state of the DFS namespace root target.
499+
471500
.PARAMETER Type
472501
Specifies the type of a DFS namespace as a Type object.
473502
@@ -512,10 +541,15 @@ function Test-TargetResource
512541
[System.String]
513542
$TargetPath,
514543

515-
[Parameter(Mandatory = $true)]
544+
[Parameter()]
516545
[ValidateSet('Present','Absent')]
517546
[System.String]
518-
$Ensure,
547+
$Ensure = 'Present',
548+
549+
[Parameter()]
550+
[ValidateSet('Offline','Online')]
551+
[System.String]
552+
$TargetState = 'Online',
519553

520554
[Parameter(Mandatory = $true)]
521555
[ValidateSet('Standalone','DomainV1','DomainV2')]
@@ -681,6 +715,17 @@ function Test-TargetResource
681715

682716
if ($target)
683717
{
718+
if (($TargetState) `
719+
-and ($target.State -ne $TargetState))
720+
{
721+
Write-Verbose -Message ( @(
722+
"$($MyInvocation.MyCommand): "
723+
$($LocalizedData.NamespaceRootTargetParameterNeedsUpdateMessage) `
724+
-f $Type,$Path,$TargetPath,'TargetState'
725+
) -join '' )
726+
$desiredConfigurationMatch = $false
727+
} # if
728+
684729
if (($ReferralPriorityClass) `
685730
-and ($target.ReferralPriorityClass -ne $ReferralPriorityClass))
686731
{

source/DSCResources/DSC_DFSNamespaceRoot/DSC_DFSNamespaceRoot.schema.mof

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ class DSC_DFSNamespaceRoot : OMI_BaseResource
33
{
44
[Key, Description("Specifies a path for the root of a DFS namespace.")] String Path;
55
[Key, Description("Specifies a path for a root target of the DFS namespace.")] String TargetPath;
6-
[Required, Description("Specifies if the DFS Namespace root should exist."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure;
6+
[Write, Description("Specifies if the DFS Namespace root should exist."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure;
7+
[Write, Description("Specifies the state of the DFS namespace root target."), ValueMap{"Offline","Online"}, Values{"Offline","Online"}] String TargetState;
78
[Required, Description("Specifies the type of a DFS namespace as a Type object."), ValueMap{"Standalone","DomainV1","DomainV2"}, Values{"Standalone","DomainV1","DomainV2"}] String Type;
89
[Write, Description("The description of the DFS Namespace.")] String Description;
910
[Write, Description("Indicates whether a DFS namespace uses cost-based selection.")] Boolean EnableSiteCosting;

0 commit comments

Comments
 (0)