Skip to content

All resources - add to NamespaceRoots, NamespaceFolders, Add ReplicationGroups, Connections & Memberships #126

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

Merged
merged 55 commits into from
Aug 3, 2023
Merged
Show file tree
Hide file tree
Changes from 50 commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
4a01afa
DFSNamespace Support for ReferralStatus (State) Modification
Jan 20, 2020
22858ff
Fixes the description of the Example 1 for DFSNamespaceFolder and DFS…
Jan 20, 2020
5960f05
Fixes a typo in Example 1 for DFSNamespaceFolder and DFSNamespaceRoot…
Jan 20, 2020
0ed203d
Add DFSReplicationGroupMember to define members separate from a group
Borgquite Oct 14, 2022
94473a2
Add DFSReplicationGroupMember tests
Borgquite Oct 17, 2022
ae78916
Allow Get-TargetResource & Test-TargetResource when replication group…
Borgquite Oct 17, 2022
9bb479a
Add support for CrossFileRDCEnabled, MinimumRDCFileSizeInKB in DSC_DF…
Borgquite Oct 17, 2022
6e1f38a
Add tests for new parameters in DFSReplicationGroupConnections
Borgquite Oct 17, 2022
ef3bcdd
Add tests for new parameters in DFSReplicationGroupMembership
Borgquite Oct 20, 2022
e4db2b7
Add new strings for DFSReplicationGroupMembership
Borgquite Oct 20, 2022
f4b4a74
Convert all 'Ensure' parameters to default to 'Present' #29
Borgquite Oct 20, 2022
0a4496e
Spelling corrections
Borgquite Oct 20, 2022
3222a08
Correction to (copied?) comment referencing incorrect file
Borgquite Oct 20, 2022
ae591f0
Merge branch 'bsmall_referral_status_support'
Borgquite Oct 20, 2022
9712700
Merge branch 'wayfair-contribs-bsmall_referral_status_support' into p…
Borgquite Oct 20, 2022
7333680
Fix ReplicationGroup integration tests testing for Namespace feature
Borgquite Oct 20, 2022
2cf8235
Rename 'State' to 'TargetState' to avoid clash with existing 'State' …
Borgquite Oct 20, 2022
370d5c2
Finalise above change
Borgquite Oct 20, 2022
c947034
Update examples to use TargetState instead of State
Borgquite Oct 20, 2022
8d31498
Revert error
Borgquite Oct 20, 2022
e27c68e
TargetState integration tests for DFSNamespaceRoot
Borgquite Oct 20, 2022
d43ac14
Fix whitespace
Borgquite Oct 20, 2022
25ca957
TargetState unit tests for DFSNamespaceFolder and DFSNamespaceRoot
Borgquite Oct 20, 2022
7df6286
Fix DFSReplicationGroupConnection EnsureRDCEnabled test
Borgquite Oct 20, 2022
f285781
Fix tests to increment instead of using fixed values
Borgquite Oct 20, 2022
f05278f
Updated CHANGELOG
Borgquite Oct 20, 2022
aa65d51
Fix error in CHANGELOG
Borgquite Oct 20, 2022
a252776
Another CHANGELOG fix
Borgquite Oct 20, 2022
8d98667
Add 'State' back into DFSNamespaceRoot Schema
Borgquite Oct 21, 2022
97f510b
Fix Set-TargetResource check for TargetState
Borgquite Oct 21, 2022
5334dc5
Update DFSReplicationGroup tests as now the Members attribute can be …
Borgquite Oct 21, 2022
050076a
Update DFSReplicationGroup tests as now the Members attribute can be …
Borgquite Oct 21, 2022
d6c6a6e
Revert ability to leave Folders blank too (breaks tests)
Borgquite Oct 21, 2022
4c605a2
Fix DFSReplicationGroup test, (spelling mistake)
Borgquite Oct 21, 2022
e98e210
DFSReplicationGroupFolder and DFSReplicationGroupMembership should no…
Borgquite Oct 21, 2022
17b791e
Fix bugs in DFSReplicationGroupMember tests
Borgquite Oct 21, 2022
1bb0c27
Update CHANGELOG
Borgquite Oct 24, 2022
d67bf3f
Separate change log entries into sections for each resource
Borgquite Nov 7, 2022
cf2ee03
New ReplicationGroup sample, fixes to TargetState descriptions
Borgquite Jan 24, 2023
18d3906
Pin build image to Ubuntu 20.04 - fixes #127
Borgquite Jan 26, 2023
2ff5142
Changelog tweaks
Borgquite Mar 10, 2023
b50de02
DFSReplicationGroup fixes - additional Member warnings, fix for empty…
Borgquite Mar 10, 2023
bd8d512
DFSReplicationGroupMember warning
Borgquite Mar 10, 2023
d434041
Fixed example
Borgquite Mar 10, 2023
cc17c15
Replace 2016-Datacenter,2016-Datacenter-Server-Core with 2019-Datacen…
Borgquite Mar 10, 2023
06f35d2
DFSReplicationGroup example Members warning
Borgquite Mar 10, 2023
25cc6a0
More DFSReplicationGroup / DFSReplicationGroupMember example fixes
Borgquite Mar 10, 2023
9a587cf
Replace -Be [$true/$false/$null] with -BeTrue -BeFalse -BeNullOrEmpty
Borgquite Mar 10, 2023
5b0c3e8
Remove unnecessary 'Offline' from examples
Borgquite Mar 10, 2023
c00f216
Revert $Members change - fix texts
Borgquite Mar 10, 2023
8d489e8
Grammatical error
Borgquite Jul 11, 2023
94bcbc5
Support clearing out members from a replication group
Borgquite Jul 11, 2023
3e568f2
Attempt to fix DFSReplicationGroup tests - 'no members'
Borgquite Jul 11, 2023
a34aeb9
Same fix for no Members for ContentPaths
Borgquite Jul 11, 2023
41438b4
Same fix as Null Members for Null Folders in tests
Borgquite Jul 11, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

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

### Fixed

Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ The **DFSDsc** module contains the following resources:
Create, edit and remove DFS Replication Group connections.
- **[DFSReplicationGroupFolder](https://github.com/PowerShell/DFSDsc/wiki/DFSReplicationGroupFolder)**:
Configure DFS Replication Group folders.
- **[DFSReplicationGroupMember](https://github.com/PowerShell/DFSDsc/wiki/DFSReplicationGroupMember)**:
Configure Replication Group Folder Members.
- **[DFSReplicationGroupMembership](https://github.com/PowerShell/DFSDsc/wiki/DFSReplicationGroupMembership)**:
Configure Replication Group Folder Membership.

Expand Down
2 changes: 1 addition & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ stages:
- job: Package_Module
displayName: 'Package Module'
pool:
vmImage: 'ubuntu-latest'
vmImage: 'ubuntu-20.04'
steps:
- pwsh: |
dotnet tool install --global GitVersion.Tool
Expand Down
1 change: 1 addition & 0 deletions source/DFSDsc.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
'DFSReplicationGroup',
'DFSReplicationGroupConnection',
'DFSReplicationGroupFolder',
'DFSReplicationGroupMember',
'DFSReplicationGroupMembership'
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ $script:localizedData = Get-LocalizedData -DefaultUICulture 'en-US'

.PARAMETER Ensure
Specifies if the DFS Namespace root should exist.

.PARAMETER TargetState
Specifies the state of the DFS namespace folder target.
#>
function Get-TargetResource
{
Expand All @@ -33,10 +36,15 @@ function Get-TargetResource
[System.String]
$TargetPath,

[Parameter(Mandatory = $true)]
[Parameter()]
[ValidateSet('Present','Absent')]
[System.String]
$Ensure
$Ensure = 'Present',

[Parameter()]
[ValidateSet('Offline','Online')]
[System.String]
$TargetState = 'Online'
)

Write-Verbose -Message ( @(
Expand Down Expand Up @@ -96,6 +104,7 @@ function Get-TargetResource
$returnValue += @{
ReferralPriorityClass = $targetFolder.ReferralPriorityClass
ReferralPriorityRank = $targetFolder.ReferralPriorityRank
TargetState = $targetFolder.State
}

Write-Verbose -Message ( @(
Expand Down Expand Up @@ -130,6 +139,9 @@ function Get-TargetResource
.PARAMETER Ensure
Specifies if the DFS Namespace root should exist.

.PARAMETER TargetState
Specifies the state of the DFS namespace folder target.

.PARAMETER Description
The description of the DFS Namespace.

Expand Down Expand Up @@ -161,10 +173,15 @@ function Set-TargetResource
[System.String]
$TargetPath,

[Parameter(Mandatory = $true)]
[Parameter()]
[ValidateSet('Present','Absent')]
[System.String]
$Ensure,
$Ensure = 'Present',

[Parameter()]
[ValidateSet('Offline','Online')]
[System.String]
$TargetState = 'Online',

[Parameter()]
[System.String]
Expand Down Expand Up @@ -212,7 +229,7 @@ function Set-TargetResource

# The Folder properties that will be updated
$folderProperties = @{
State = 'online'
State = 'Online'
}

if (($Description) `
Expand Down Expand Up @@ -280,6 +297,15 @@ function Set-TargetResource
$targetProperties = @{}

# Check the target properties
if (($TargetState) `
-and ($targetFolder.State -ne $TargetState))
{
$targetProperties += @{
State = $TargetState
}
$targetChange = $true
}

if (($ReferralPriorityClass) `
-and ($targetFolder.ReferralPriorityClass -ne $ReferralPriorityClass))
{
Expand Down Expand Up @@ -399,6 +425,9 @@ function Set-TargetResource
.PARAMETER Ensure
Specifies if the DFS Namespace root should exist.

.PARAMETER TargetState
Specifies the state of the DFS namespace folder target.

.PARAMETER Description
The description of the DFS Namespace.

Expand Down Expand Up @@ -431,10 +460,15 @@ function Test-TargetResource
[System.String]
$TargetPath,

[Parameter(Mandatory = $true)]
[Parameter()]
[ValidateSet('Present','Absent')]
[System.String]
$Ensure,
$Ensure = 'Present',

[Parameter()]
[ValidateSet('Offline','Online')]
[System.String]
$TargetState = 'Online',

[Parameter()]
[System.String]
Expand Down Expand Up @@ -533,6 +567,17 @@ function Test-TargetResource

if ($targetFolder)
{
if (($TargetState) `
-and ($targetFolder.State -ne $TargetState))
{
Write-Verbose -Message ( @(
"$($MyInvocation.MyCommand): "
$($LocalizedData.NamespaceFolderTargetParameterNeedsUpdateMessage) `
-f $Path,$TargetPath,'TargetState'
) -join '' )
$desiredConfigurationMatch = $false
}

if (($ReferralPriorityClass) `
-and ($targetFolder.ReferralPriorityClass -ne $ReferralPriorityClass))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ class DSC_DFSNamespaceFolder : OMI_BaseResource
{
[Key, Description("Specifies a path for the root of a DFS namespace.")] String Path;
[Key, Description("Specifies a path for a root target of the DFS namespace.")] String TargetPath;
[Required, Description("Specifies if the DFS Namespace root should exist."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure;
[Write, Description("Specifies if the DFS Namespace root should exist."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure;
[Write, Description("Specifies the state of the DFS namespace folder target."), ValueMap{"Offline","Online"}, Values{"Offline","Online"}] String TargetState;
[Write, Description("The description of the DFS Namespace.")] String Description;
[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;
[Write, Description("Indicates whether a DFS namespace uses target failback.")] Boolean EnableTargetFailback;
Expand Down
59 changes: 52 additions & 7 deletions source/DSCResources/DSC_DFSNamespaceRoot/DSC_DFSNamespaceRoot.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ $script:localizedData = Get-LocalizedData -DefaultUICulture 'en-US'
.PARAMETER Ensure
Specifies if the DFS Namespace root should exist.

.PARAMETER TargetState
Specifies the state of the DFS namespace root target.

.PARAMETER Type
Specifies the type of a DFS namespace as a Type object.
#>
Expand All @@ -36,10 +39,15 @@ function Get-TargetResource
[System.String]
$TargetPath,

[Parameter(Mandatory = $true)]
[Parameter()]
[ValidateSet('Present','Absent')]
[System.String]
$Ensure,
$Ensure = 'Present',

[Parameter()]
[ValidateSet('Offline','Online')]
[System.String]
$TargetState = 'Online',

[Parameter(Mandatory = $true)]
[ValidateSet('Standalone','DomainV1','DomainV2')]
Expand Down Expand Up @@ -108,6 +116,7 @@ function Get-TargetResource
$returnValue += @{
ReferralPriorityClass = $target.ReferralPriorityClass
ReferralPriorityRank = $target.ReferralPriorityRank
TargetState = $target.State
}

Write-Verbose -Message ( @(
Expand Down Expand Up @@ -142,6 +151,9 @@ function Get-TargetResource
.PARAMETER Ensure
Specifies if the DFS Namespace root should exist.

.PARAMETER TargetState
Specifies the state of the DFS namespace root target.

.PARAMETER Type
Specifies the type of a DFS namespace as a Type object.

Expand Down Expand Up @@ -185,10 +197,15 @@ function Set-TargetResource
[System.String]
$TargetPath,

[Parameter(Mandatory = $true)]
[Parameter()]
[ValidateSet('Present','Absent')]
[System.String]
$Ensure,
$Ensure = 'Present',

[Parameter()]
[ValidateSet('Offline','Online')]
[System.String]
$TargetState = 'Online',

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

# The root properties that will be updated
$rootProperties = @{
State = 'online'
State = 'Online'
}

if (($Description) `
Expand Down Expand Up @@ -348,6 +365,15 @@ function Set-TargetResource
$targetProperties = @{}

# Check the target properties
if (($TargetState) `
-and ($target.State -ne $TargetState))
{
$targetProperties += @{
State = $TargetState
}
$targetChange = $true
} # if

if (($ReferralPriorityClass) `
-and ($target.ReferralPriorityClass -ne $ReferralPriorityClass))
{
Expand Down Expand Up @@ -468,6 +494,9 @@ function Set-TargetResource
.PARAMETER Ensure
Specifies if the DFS Namespace root should exist.

.PARAMETER TargetState
Specifies the state of the DFS namespace root target.

.PARAMETER Type
Specifies the type of a DFS namespace as a Type object.

Expand Down Expand Up @@ -512,10 +541,15 @@ function Test-TargetResource
[System.String]
$TargetPath,

[Parameter(Mandatory = $true)]
[Parameter()]
[ValidateSet('Present','Absent')]
[System.String]
$Ensure,
$Ensure = 'Present',

[Parameter()]
[ValidateSet('Offline','Online')]
[System.String]
$TargetState = 'Online',

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

if ($target)
{
if (($TargetState) `
-and ($target.State -ne $TargetState))
{
Write-Verbose -Message ( @(
"$($MyInvocation.MyCommand): "
$($LocalizedData.NamespaceRootTargetParameterNeedsUpdateMessage) `
-f $Type,$Path,$TargetPath,'TargetState'
) -join '' )
$desiredConfigurationMatch = $false
} # if

if (($ReferralPriorityClass) `
-and ($target.ReferralPriorityClass -ne $ReferralPriorityClass))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ class DSC_DFSNamespaceRoot : OMI_BaseResource
{
[Key, Description("Specifies a path for the root of a DFS namespace.")] String Path;
[Key, Description("Specifies a path for a root target of the DFS namespace.")] String TargetPath;
[Required, Description("Specifies if the DFS Namespace root should exist."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure;
[Write, Description("Specifies if the DFS Namespace root should exist."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure;
[Write, Description("Specifies the state of the DFS namespace root target."), ValueMap{"Offline","Online"}, Values{"Offline","Online"}] String TargetState;
[Required, Description("Specifies the type of a DFS namespace as a Type object."), ValueMap{"Standalone","DomainV1","DomainV2"}, Values{"Standalone","DomainV1","DomainV2"}] String Type;
[Write, Description("The description of the DFS Namespace.")] String Description;
[Write, Description("Indicates whether a DFS namespace uses cost-based selection.")] Boolean EnableSiteCosting;
Expand Down
Loading