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

BREAKING CHANGE: SQLAlwaysOnService: Get-TargetResource should return Ensure=Absent #1759

Closed
jrdbarnes opened this issue Jun 22, 2022 · 1 comment · Fixed by #1760
Closed
Labels
breaking change When used on an issue, the issue has been determined to be a breaking change. enhancement The issue is an enhancement request. good first issue The issue should be easier to fix and can be taken up by a beginner to learn to contribute on GitHub

Comments

@jrdbarnes
Copy link
Contributor

Problem description

When SQL Always On is disabled and you wish to enable it, Get-TargetResource returns

  Ensure = 'Present'
  IsHadrEnabled  = $false

It seems odd to not just return Ensure = 'Absent' instead of having an additional parameter?

Verbose logs

ConfigurationName    :
DependsOn            :
ModuleName           : C:/ProgramData/PuppetLabs/puppet/cache/lib/puppet_x/sqlserverdsc/dsc_resources/SqlServerDsc/SqlServerDsc.psd1
ModuleVersion        : 15.2.0
PsDscRunAsCredential :
ResourceId           :
SourceInfo           :
Ensure               : Present
InstanceName         : MSSQLSERVER
IsHadrEnabled        : False
RestartTimeout       : 120
ServerName           : CORESQL02
PSComputerName       : localhost

DSC configuration

$InvokeParams = @{
  Name = 'SqlAlwaysOnService'; 
  Method = 'get'; 
  Property = @{
            Ensure               = 'Present'
            InstanceName         = 'MSSQLSERVER'
            RestartTimeout       = 120
        }; 
  ModuleName = @{
            ModuleName = 'C:/ProgramData/PuppetLabs/puppet/cache/lib/puppet_x/sqlserverdsc/dsc_resources/SqlServerDsc/SqlServerDsc.psd1'; 
            RequiredVersion = '15.2.0'}}

Invoke-DscResource @InvokeParams

Suggested solution

Remove IsHadrEnabled and return the state in Ensure. Update Test-TargetResource to look at Ensure instead of IsHadrEnabled

SQL Server edition and version

Microsoft SQL Server 2019 (RTM-CU16-GDR) (KB5014353) - 15.0.4236.7 (X64)   May 29 2022 15:55:47   Copyright (C) 2019 Microsoft Corporation  Enterprise Edition: Core-based Licensing (64-bit) on Windows Server 2019 Standard 10.0 <X64> (Build 17763: )

SQL Server PowerShell modules

Name  Version Path
----  ------- ----
SQLPS 15.0    E:\Program Files (x86)\Microsoft SQL Server\150\Tools\PowerShell\Modules\SQLPS\SQLPS.psd1

Operating system

OsName               : Microsoft Windows Server 2019 Standard
OsOperatingSystemSKU : StandardServerEdition
OsArchitecture       : 64-bit
WindowsVersion       : 1809
WindowsBuildLabEx    : 17763.1.amd64fre.rs5_release.180914-1434
OsLanguage           : en-US
OsMuiLanguages       : {en-US}

PowerShell version

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

SqlServerDsc version

15.2.0
@johlju
Copy link
Member

johlju commented Jun 22, 2022

Sounds good. Happy to review a PR for this. It will be a breaking change for those expecting the property IsHadrEnabled but since we are about to release a breaking change release this will be perfect to merge before release.

@johlju johlju added enhancement The issue is an enhancement request. help wanted The issue is up for grabs for anyone in the community. breaking change When used on an issue, the issue has been determined to be a breaking change. good first issue The issue should be easier to fix and can be taken up by a beginner to learn to contribute on GitHub labels Jun 22, 2022
@johlju johlju changed the title SQLAlwaysOnService: Get-TargetResource should return Ensure=Absent BREAKING CHANGE: SQLAlwaysOnService: Get-TargetResource should return Ensure=Absent Jun 22, 2022
jrdbarnes added a commit to jrdbarnes/SqlServerDsc that referenced this issue Jun 23, 2022
…n Ensure=Absent

Remove IsHadrEnabled and return the state in Ensure.
Update Test-TargetResource to look at Ensure instead of IsHadrEnabled.
Update Tests to match.
@johlju johlju added in progress The issue is being actively worked on by someone. and removed help wanted The issue is up for grabs for anyone in the community. labels Jun 23, 2022
@johlju johlju removed the in progress The issue is being actively worked on by someone. label Jul 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change When used on an issue, the issue has been determined to be a breaking change. enhancement The issue is an enhancement request. good first issue The issue should be easier to fix and can be taken up by a beginner to learn to contribute on GitHub
Projects
None yet
2 participants