-
Notifications
You must be signed in to change notification settings - Fork 225
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
SqlSetup: Add missing properties: Service Startup Type (SQLENGINE/AGT,AS,IS,RS) #1184
SqlSetup: Add missing properties: Service Startup Type (SQLENGINE/AGT,AS,IS,RS) #1184
Conversation
…artup types of the installed services.
Codecov Report
@@ Coverage Diff @@
## dev #1184 +/- ##
=====================================
+ Coverage 97% 97% +<1%
=====================================
Files 33 33
Lines 4016 4044 +28
=====================================
+ Hits 3929 3957 +28
Misses 87 87 |
Awesome!! I will review this one after the weekend :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 3 of 6 files at r1, 3 of 3 files at r2.
Reviewable status: all files reviewed, 13 unresolved discussions (waiting on @mdaniou)
a discussion (no related file):
Can we add the once that are possible to the integration test as well? Not all services are installed in the tests yet, so at least test those that can.
SQL Engine, SQL Agent, Browser
Config: https://github.com/PowerShell/SqlServerDsc/blob/dev/Tests/Integration/MSFT_SqlSetup.config.ps1#L193
Tests: https://github.com/PowerShell/SqlServerDsc/blob/dev/Tests/Integration/MSFT_SqlSetup.Integration.Tests.ps1#L244
CHANGELOG.md, line 37 at r2 (raw file):
service, the Agent service, the Analysis service and the Integration Service. The new optional parameters are respectively SqlSvcStartupType, AgtSvcStartupType, AsSvcStartupType, IsSvcStartupType and RsSvcStartupType.
Can we add the following to the end of the sentence? Referencing the issue.
...RsSvcStartupType. ([issue #1165](https://github.com/PowerShell/SqlServerDsc/issues/1165).
You may also add your name to this change if you like (optional)
* Descriptive entry ([issue #123](https://github.com/PowerShell/xPSDesiredStateConfiguration/issues/123). [Name/Alias (@github_account)](https://github.com/github_account)
README.md, line 1636 at r2 (raw file):
* **`[PSCredential]` ISSvcAccount** _(Write)_: Service account for Integration Services service. * **`[String]` SqlSvcStartupType** _(Write)_: Specifies the startup mode for
Should we add something to the description what the default is if left out? 🤔 If so, please update comment-based help and schema.mof as well.
README.md, line 1637 at r2 (raw file):
'Manual'
Should be just Manual without the single quotes? To be like to other two. Throughout.
DSCResources/MSFT_SqlSetup/MSFT_SqlSetup.psm1, line 648 at r2 (raw file):
.PARAMETER SqlSvcStartupType Specifies the startup mode for SQL Server Engine service
We should end the sentence with full stop (.) to be consequent. Throughout.
DSCResources/MSFT_SqlSetup/MSFT_SqlSetup.psm1, line 1291 at r2 (raw file):
$setupArguments += @{ AgtSvcStartupType = 'Automatic' }
If this is the default value for this property, then I suggest to add that in an else-block on the if-block below. No need to set it twice if it is assigned a value in the configuration.
DSCResources/MSFT_SqlSetup/MSFT_SqlSetup.psm1, line 1291 at r2 (raw file):
$setupArguments += @{ AgtSvcStartupType = 'Automatic' }
If this is the default value, then we should highlight that in the README.md like { *Automatic* | Disabled | 'Manual' }
. Making the value 'Automatic' italic to show it's the default. It should also say in the description that it is the default.
DSCResources/MSFT_SqlSetup/MSFT_SqlSetup.psm1, line 1298 at r2 (raw file):
$null -ne $SqlSvcStartupType
We can use $PSBoundParameters.ContainsKey for this as well?
DSCResources/MSFT_SqlSetup/MSFT_SqlSetup.psm1, line 1319 at r2 (raw file):
$setupArguments += (Get-ServiceAccountParameters -ServiceAccount $RSSvcAccount -ServiceType 'RS') } if ($null -ne $RsSvcStartupType)
We can use $PSBoundParameters.ContainsKey for this as well?
DSCResources/MSFT_SqlSetup/MSFT_SqlSetup.psm1, line 1365 at r2 (raw file):
} if ( $null -ne $AsSvcStartupType )
We can use $PSBoundParameters.ContainsKey for this as well?
DSCResources/MSFT_SqlSetup/MSFT_SqlSetup.psm1, line 1378 at r2 (raw file):
} if ( $null -ne $IsSvcStartupType )
We can use $PSBoundParameters.ContainsKey for this as well?
DSCResources/MSFT_SqlSetup/MSFT_SqlSetup.psm1, line 1685 at r2 (raw file):
.PARAMETER SqlSvcStartupType Specifies the startup mode for SQL Server Engine service
We should end the sentence with full stop (.) to be consequent. Throughout.
Examples/Resources/SqlSetup/6-InstallNamedInstanceSingleServerWithAgtSvcStartupTypeDisabled.ps1, line 4 at r2 (raw file):
.EXAMPLE This example shows how to install a named instance of SQL Server on a single server. .NOTES
Add a blank row before this row.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: all files reviewed, 13 unresolved discussions (waiting on @mdaniou and @johlju)
CHANGELOG.md, line 37 at r2 (raw file):
Name/Alias (@github_account)
ok , thanks
README.md, line 1636 at r2 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
Should we add something to the description what the default is if left out? 🤔 If so, please update comment-based help and schema.mof as well.
I don't think that we should specify that. If the default installation configs are updated in the future, we would have to update the information here as well.
We already know that whatever you don't specify will be default.
Now about the Agent service that is set to Manual by default when installing Sql Server whereas it is Automatic in this DSC, I think that it is a problem. However I didn't want to make any breaking change ...
In conclusion, I might want to specify the default value for the agent only or remove the Automatic value if left out (then creating a breaking change).
Do you get my point ?
README.md, line 1637 at r2 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
'Manual'
Should be just Manual without the single quotes? To be like to other two. Throughout.
Right, I copies/pasted the Browser description :)
DSCResources/MSFT_SqlSetup/MSFT_SqlSetup.psm1, line 648 at r2 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
We should end the sentence with full stop (.) to be consequent. Throughout.
Ok, I do that for the whole script at the same time.
DSCResources/MSFT_SqlSetup/MSFT_SqlSetup.psm1, line 1291 at r2 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
$setupArguments += @{ AgtSvcStartupType = 'Automatic' }
If this is the default value for this property, then I suggest to add that in an else-block on the if-block below. No need to set it twice if it is assigned a value in the configuration.
I had done that at the beginning then I had problems during the tests as it was not taking the account the else block for some reasons. I used this workaround.
Don't ask me more details as I wouldn't be able to explain. :)
I create the else block and I'll see. Maybe I was a bit tired !
DSCResources/MSFT_SqlSetup/MSFT_SqlSetup.psm1, line 1298 at r2 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
$null -ne $SqlSvcStartupType
We can use $PSBoundParameters.ContainsKey for this as well?
I agree, although I was not sure. Would you qualify this as a good practice ?
DSCResources/MSFT_SqlSetup/MSFT_SqlSetup.psm1, line 1319 at r2 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
We can use $PSBoundParameters.ContainsKey for this as well?
yes
DSCResources/MSFT_SqlSetup/MSFT_SqlSetup.psm1, line 1365 at r2 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
We can use $PSBoundParameters.ContainsKey for this as well?
yes
DSCResources/MSFT_SqlSetup/MSFT_SqlSetup.psm1, line 1378 at r2 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
We can use $PSBoundParameters.ContainsKey for this as well?
yes
DSCResources/MSFT_SqlSetup/MSFT_SqlSetup.psm1, line 1685 at r2 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
We should end the sentence with full stop (.) to be consequent. Throughout.
ok
Examples/Resources/SqlSetup/6-InstallNamedInstanceSingleServerWithAgtSvcStartupTypeDisabled.ps1, line 4 at r2 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
Add a blank row before this row.
sure
a discussion (no related file): Previously, johlju (Johan Ljunggren) wrote…
I don't feel comfortable touching all these integration stuff. Let me first handle all the other comments and I will have a look at this. |
@mdaniou I know, it's the same for me - the tests take a lot of work - but it is worth the time in the end 🙂 |
@mdaniou Just a gentle reminder to write 'Done' on the review comments when you are finished, so I know I should review again. No hurry though, take the time you need. :) |
@mdaniou Is this one ready for review again? |
@johlju not yet. This is holiday time so I will handle that in August. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for you reply. Answer the questions. 🙂
Just a couple of review comments left, I have acknowledge the others
Have a lovely holiday!
Reviewed 4 of 4 files at r3.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @johlju)
a discussion (no related file):
Previously, mdaniou (Maxime Daniou) wrote…
I don't feel comfortable touching all these integration stuff. Let me first handle all the other comments and I will have a look at this.
To be honest, I spend 10x more time working on the test part then actually updating the DSC script.
Only the integration tests left now I think. Let me know if you need any pointers with those.
README.md, line 1636 at r2 (raw file):
Previously, mdaniou (Maxime Daniou) wrote…
I don't think that we should specify that. If the default installation configs are updated in the future, we would have to update the information here as well.
We already know that whatever you don't specify will be default.
Now about the Agent service that is set to Manual by default when installing Sql Server whereas it is Automatic in this DSC, I think that it is a problem. However I didn't want to make any breaking change ...In conclusion, I might want to specify the default value for the agent only or remove the Automatic value if left out (then creating a breaking change).
Do you get my point ?
I agree with what you say here. I also agree that Automatic value should not be default if that parameter is left out.
Can you please submit a new issue to track this? That could be another PR that introduces a breaking change for this.
DSCResources/MSFT_SqlSetup/MSFT_SqlSetup.psm1, line 1291 at r2 (raw file):
Previously, mdaniou (Maxime Daniou) wrote…
I had done that at the beginning then I had problems during the tests as it was not taking the account the else block for some reasons. I used this workaround.
Don't ask me more details as I wouldn't be able to explain. :)
I create the else block and I'll see. Maybe I was a bit tired !
Looks like the tests agrees with this change :)
DSCResources/MSFT_SqlSetup/MSFT_SqlSetup.psm1, line 1291 at r2 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
$setupArguments += @{ AgtSvcStartupType = 'Automatic' }
If this is the default value, then we should highlight that in the README.md like
{ *Automatic* | Disabled | 'Manual' }
. Making the value 'Automatic' italic to show it's the default. It should also say in the description that it is the default.
Withdraw this comment as this will be obsolete when the new breaking change issue discussed in another comment is fixed in another PR.
DSCResources/MSFT_SqlSetup/MSFT_SqlSetup.psm1, line 1298 at r2 (raw file):
Previously, mdaniou (Maxime Daniou) wrote…
I agree, although I was not sure. Would you qualify this as a good practice ?
More being consequent, as the other code used it, than good practice. Although it is easier to read, and it now only adds the argument if the parameter was passed, as the previous could have added the argument if the value was change from a $null value in the previous code.
Labeling this pull request (PR) as abandoned since it has gone 14 days or more since the last update. An abandoned PR can be continued by another contributor. The abandoned label will be removed if work on this PR is taken up again. |
yes I know I need to handle this ! :) |
@mdaniou great if we can get this over the finish line. 😃 The abandoned label should be removed once you push next time. |
I forgot to add a 😃, so updated previous comment 😄 |
README.md, line 1636 at r2 (raw file): Previously, johlju (Johan Ljunggren) wrote…
Cool thanks, Issue #1198 created |
Tests/Integration/MSFT_SqlSetup.Integration.Tests.ps1, line 251 at r4 (raw file): Previously, johlju (Johan Ljunggren) wrote…
This would only work if I modify the Get-TargetResource function right. My understanding is that this function is run by Get-DscConfiguration. |
Tests/Integration/MSFT_SqlSetup.Integration.Tests.ps1, line 251 at r4 (raw file): Previously, mdaniou (Maxime Daniou) wrote…
I have done some tests and got the answer. :) |
@mdaniou Great that you found the answer. 🙂 |
Tests/Integration/MSFT_SqlSetup.Integration.Tests.ps1, line 251 at r4 (raw file): Previously, mdaniou (Maxime Daniou) wrote…
Done. |
All good here I think 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work! This is almost complete now! Just a minor comment.
Reviewed 2 of 2 files at r5, 1 of 1 files at r6.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @mdaniou)
DSCResources/MSFT_SqlSetup/MSFT_SqlSetup.psm1, line 138 at r6 (raw file):
Quoted 4 lines of code…
If ($SqlSvcStartupType -eq 'Auto') { $SqlSvcStartupType = 'Automatic' }
Could we make this a helper function instead? Passing in the StartMode
and returning the correct value. Then we don't have to repeat the same if-block 5 times? What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 7 of 8 files reviewed, 1 unresolved discussion (waiting on @johlju)
DSCResources/MSFT_SqlSetup/MSFT_SqlSetup.psm1, line 138 at r6 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
If ($SqlSvcStartupType -eq 'Auto') { $SqlSvcStartupType = 'Automatic' }
Could we make this a helper function instead? Passing in the
StartMode
and returning the correct value. Then we don't have to repeat the same if-block 5 times? What do you think?
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 1 files at r7.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @mdaniou)
DSCResources/MSFT_SqlSetup/MSFT_SqlSetup.psm1, line 135 at r7 (raw file):
$agentServiceAccountUsername = $agentServiceCimInstance.StartName $SqlSvcStartupType = Set-StringToAutomatic $sqlServiceCimInstance.StartMode
We should use named parameters, so this should be -StartMode $sqlServiceCimInstance.StartMode
(see next comment for the rename of the parameter).
DSCResources/MSFT_SqlSetup/MSFT_SqlSetup.psm1, line 2343 at r7 (raw file):
Set-StringToAutomatic
I suggest we rename the function to ConvertTo-StartupType
, then it will be able to handle future types that need to be converted.
Update the comment-based help to explain what it does.
DSCResources/MSFT_SqlSetup/MSFT_SqlSetup.psm1, line 2349 at r7 (raw file):
$String
I think we should call this parameter $StartMode, and make sure the the comment-based help is updated to explain what should be passed in.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mdaniou Looking much better! Just minor comments left! After these comments I think it ready to merge. 🙂
Reviewed 1 of 1 files at r8.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @mdaniou)
DSCResources/MSFT_SqlSetup/MSFT_SqlSetup.psm1, line 135 at r8 (raw file):
$SqlSvcStartupType = ConvertTo-StartupType $sqlServiceCimInstance.StartMode
We should use named parameters, we should add -StartMode
here. so this should be
$SqlSvcStartupType = ConvertTo-StartupType -StartMode $sqlServiceCimInstance.StartMode
Throughout on the 4 other occurances to.
DSCResources/MSFT_SqlSetup/MSFT_SqlSetup.psm1, line 2338 at r8 (raw file):
Modify value to be 'Automatic' if it is 'Auto'. Otherwise returns the same string
Could we change this description to something like: "Converts the start mode property returned by a Win32_Service CIM object to the resource properties *StartupType equivalent"
DSCResources/MSFT_SqlSetup/MSFT_SqlSetup.psm1, line 2340 at r8 (raw file):
String
Should me StartMode
DSCResources/MSFT_SqlSetup/MSFT_SqlSetup.psm1, line 2341 at r8 (raw file):
String to check.
Maybe we can change this to "The StartMode to convert."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @johlju)
DSCResources/MSFT_SqlSetup/MSFT_SqlSetup.psm1, line 135 at r8 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
$SqlSvcStartupType = ConvertTo-StartupType $sqlServiceCimInstance.StartMode
We should use named parameters, we should add
-StartMode
here. so this should be$SqlSvcStartupType = ConvertTo-StartupType -StartMode $sqlServiceCimInstance.StartMode
Throughout on the 4 other occurances to.
Done.
DSCResources/MSFT_SqlSetup/MSFT_SqlSetup.psm1, line 2338 at r8 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
Modify value to be 'Automatic' if it is 'Auto'. Otherwise returns the same string
Could we change this description to something like: "Converts the start mode property returned by a Win32_Service CIM object to the resource properties *StartupType equivalent"
Done.
DSCResources/MSFT_SqlSetup/MSFT_SqlSetup.psm1, line 2340 at r8 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
String
Should me StartMode
Done.
DSCResources/MSFT_SqlSetup/MSFT_SqlSetup.psm1, line 2341 at r8 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
String to check.
Maybe we can change this to "The StartMode to convert."
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 1 files at r9.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @johlju)
DSCResources/MSFT_SqlSetup/MSFT_SqlSetup.psm1, line 2340 at r8 (raw file):
Previously, mdaniou (Maxime Daniou) wrote…
Done.
This one wasn't changed, should be .PARAMETER StartMode
.
DSCResources/MSFT_SqlSetup/MSFT_SqlSetup.psm1, line 2340 at r8 (raw file): Previously, johlju (Johan Ljunggren) wrote…
Yes indeed ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 1 files at r10.
Reviewable status: complete! all files reviewed, all discussions resolved
@mdaniou Awesome work on this one! Just waiting for the tests to pass, then I merge. |
👍 |
@johlju : It seems like the entry for this change in the CHANGE.LOG is not in UNRELEASED. Instead it is under 11.4.0.0. https://github.com/PowerShell/SqlServerDsc/blob/dev/CHANGELOG.md#11400 |
Yes, tests are a hill to climb over until you get hang of it, but they are well worth the effort! Yes, I saw that the change log merged into wrong place. I does that after a release. I have a PR open to fix it. Waiting for the test to pass and then I will merge that PR. Thanks for noticing and reporting it! |
Btw, I usually see that the change log will act up when I review, and ask for a rebase against dev, this time I missed it. :) |
Pull Request (PR) description
Added new parameters to allow to define the Startup Types of the services while installing them
This Pull Request (PR) fixes the following issues
Fixes #1165
Task list
should say what was changed, and how that affects users (if applicable).
and comment-based help?
See DSC Resource Testing Guidelines.
See DSC Resource Testing Guidelines.
DSC Resource Style Guidelines
and Best Practices?
This change is