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

xSQLServerAlwaysOnService: Returns IsHadrEnabled -eq $null #763

Closed
johlju opened this issue Aug 15, 2017 · 2 comments · Fixed by #768
Closed

xSQLServerAlwaysOnService: Returns IsHadrEnabled -eq $null #763

johlju opened this issue Aug 15, 2017 · 2 comments · Fixed by #768
Labels
enhancement The issue is an enhancement request.

Comments

@johlju
Copy link
Member

johlju commented Aug 15, 2017

Details of the scenario you tried and the problem that is occurring:
Sometimes this row returns $null resulting in an exception. This most likely due to that the server has not been restarted after setup. I'm guessing, because I hit this issue during integration testing. And there I am suppressing reboot.
If we instead cast this row to a Boolean, it will always return false if it is false or $null.

https://github.com/PowerShell/xSQLServer/blob/dev/DSCResources/MSFT_xSQLServerAlwaysOnService/MSFT_xSQLServerAlwaysOnService.psm1#L45

The DSC configuration that is using the resource (as detailed as possible):
test run here: https://ci.appveyor.com/project/johlju/xsqlserver/build/6.0.851.0#L1652

Version of the Operating System, SQL Server and PowerShell the DSC Target Node is running:
n/a

What module (SqlServer or SQLPS) and which version of the module the DSC Target Node is running:
n/a

Version of the DSC module you're using, or 'dev' if you're using current dev branch:
Dev

@johlju johlju added enhancement The issue is an enhancement request. help wanted The issue is up for grabs for anyone in the community. labels Aug 15, 2017
@johlju
Copy link
Member Author

johlju commented Aug 15, 2017

Wrong link to error message. Above link is test run after testing casting to boolean. This is the correct url showing the error.
https://ci.appveyor.com/project/johlju/xsqlserver/build/6.0.848.0#L1658

@johlju
Copy link
Member Author

johlju commented Aug 16, 2017

The error message returned is

The status of property Server.IsHadrEnabled was neither $true or $false. Status is ''

Casting the return value to [System.Boolean] will make sure a $null value is never returned, and Test-TargetResource will always return $false if IsHadrEnabled property can't be read correctly.

@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 Aug 16, 2017
johlju added a commit to johlju/SqlServerDsc that referenced this issue Aug 16, 2017
- Casting the result of the property IshardEnabled to to [System.Boolean] so that
  $null is never returned, which resulted in an exception (issue dsccommunity#763).
johlju added a commit to johlju/SqlServerDsc that referenced this issue Aug 16, 2017
- Casting the result of the property IsHadrEnabled to [System.Boolean] so that
  $null is never returned, which resulted in an exception (issue dsccommunity#763).
johlju added a commit to johlju/SqlServerDsc that referenced this issue Aug 16, 2017
- Casting the result of the property IsHadrEnabled to [System.Boolean] so that
  $null is never returned, which resulted in an exception (issue dsccommunity#763).
johlju added a commit to johlju/SqlServerDsc that referenced this issue Aug 16, 2017
- Casting the result of the property IsHadrEnabled to [System.Boolean] so that
  $null is never returned, which resulted in an exception (issue dsccommunity#763).
johlju added a commit to johlju/SqlServerDsc that referenced this issue Aug 17, 2017
- Casting the result of the property IsHadrEnabled to [System.Boolean] so that
  $null is never returned, which resulted in an exception (issue dsccommunity#763).
johlju added a commit that referenced this issue Aug 18, 2017
…768)

- Changes to xSQLServerAlwaysOnService
  - Casting the result of the property IsHadrEnabled to [System.Boolean] so that $null is never returned, 
    which resulted in an exception (issue #763).
@johlju johlju removed the in progress The issue is being actively worked on by someone. label Oct 27, 2017
@johlju johlju removed their assignment Oct 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement The issue is an enhancement request.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant