Skip to content

Commit

Permalink
Changes to xSQLServerSetup
Browse files Browse the repository at this point in the history
Added a note to the README.md saying that it is not possible to add or remove features from a SQL Server failover cluster (issue dsccommunity#433).
Changed so that it reports false if the desired state is not correct (issue dsccommunity#432).
  • Loading branch information
johlju committed Mar 11, 2017
1 parent 4e21f50 commit ecf18ae
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
15 changes: 8 additions & 7 deletions DSCResources/MSFT_xSQLServerSetup/MSFT_xSQLServerSetup.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -953,7 +953,7 @@ function Set-TargetResource
# Get the disk resources that are available (not assigned to a cluster role)
$availableStorage = Get-CimInstance -Namespace 'root/MSCluster' -ClassName 'MSCluster_ResourceGroup' -Filter "Name = 'Available Storage'" |
Get-CimAssociatedInstance -Association MSCluster_ResourceGroupToResource -ResultClassName MSCluster_Resource | `
Add-Member -MemberType NoteProperty -Name 'IsPossibleOwner' -Value $false -PassThru
Add-Member -MemberType NoteProperty -Name 'IsPossibleOwner' -Value $false -PassThru

# First map regular cluster volumes
foreach ($diskResource in $availableStorage)
Expand Down Expand Up @@ -1651,11 +1651,10 @@ function Test-TargetResource
$getTargetResourceResult = Get-TargetResource @getTargetResourceParameters
New-VerboseMessage -Message "Features found: '$($getTargetResourceResult.Features)'"

$result = $false
$result = $true

if ($getTargetResourceResult.Features )
{
$result = $true

foreach ($feature in $Features.Split(","))
{
# Given that all the returned features are uppercase, make sure that the feature to search for is also uppercase
Expand All @@ -1668,13 +1667,15 @@ function Test-TargetResource
}
}
}
else
{
$result = $false
}

if ($PSCmdlet.ParameterSetName -eq 'ClusterInstall')
{
New-VerboseMessage -Message "Clustered install, checking parameters."

$result = $true

$boundParameters.Keys | Where-Object {$_ -imatch "^FailoverCluster"} | ForEach-Object {
$variableName = $_

Expand All @@ -1685,7 +1686,7 @@ function Test-TargetResource
}
}

$result
return $result
}

<#
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -887,6 +887,9 @@ Installs SQL Server on the target node.
* ASSysAdminAccounts
* AsSvcAccount

> **Note:** It is not possible to add or remove features to a SQL Server failover cluster. This is a limitation of SQL Server.
> See article [You cannot add or remove features to a SQL Server 2008, SQL Server 2008 R2, or SQL Server 2012 failover cluster](https://support.microsoft.com/en-us/help/2547273/you-cannot-add-or-remove-features-to-a-sql-server-2008,-sql-server-2008-r2,-or-sql-server-2012-failover-cluster).
#### Parameters

* **[String] Action** _(Write)_: The action to be performed. Defaults to 'Install'. *Note: AddNode is not currently functional.* { _Install_ | InstallFailoverCluster | AddNode | PrepareFailoverCluster | CompleteFailoverCluster }
Expand Down

0 comments on commit ecf18ae

Please sign in to comment.