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

SqlSetup: Added support for RSINSTALLMODE parameter #1361

Merged
merged 2 commits into from
Jun 19, 2019

Conversation

bozho
Copy link
Contributor

@bozho bozho commented May 21, 2019

Pull Request (PR) description

Added RSInstallMode parameter, to support RSINSTALLMODE SQL Setup config option.

This Pull Request (PR) fixes the following issues

Task list

  • Added an entry under the Unreleased section of the change log in the CHANGELOG.md.
    Entry should say what was changed, and how that affects users (if applicable).
  • Resource documentation added/updated in README.md.
  • Resource parameter descriptions added/updated in README.md, schema.mof
    and comment-based help.
  • Comment-based help added/updated.
  • Localization strings added/updated in all localization files as appropriate.
  • Examples appropriately added/updated.
  • Unit tests added/updated. See DSC Resource Testing Guidelines.
  • Integration tests added/updated (where possible). See DSC Resource Testing Guidelines.
  • New/changed code adheres to DSC Resource Style Guidelines and Best Practices.

This change is Reviewable

Copy link
Member

@johlju johlju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 2 of 4 files at r1.
Reviewable status: 2 of 4 files reviewed, 2 unresolved discussions (waiting on @bozho)


DSCResources/MSFT_SqlSetup/MSFT_SqlSetup.psm1, line 528 at r1 (raw file):

    }

    return @{

We need to return the RSInstallMode property here. Can we detect the install mode from registry or by some other means?


DSCResources/MSFT_SqlSetup/MSFT_SqlSetup.psm1, line 1457 at r1 (raw file):

$setupArguments += @{ RSINSTALLMODE = $RSInstallMode}

We should test this line in a unit test.

Copy link
Member

@johlju johlju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 2 of 4 files at r1.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @bozho)

@johlju johlju added the waiting for code fix A review left open comments, and the pull request is waiting for changes to be pushed by the author. label May 24, 2019
@bozho
Copy link
Contributor Author

bozho commented Jun 19, 2019

@johlju Apologies, I didn't get a notification about your reply... I'll get on this

@bozho bozho force-pushed the issue-1163-rs-install-mode branch from e9d83ea to 2c07dff Compare June 19, 2019 08:42
@codecov-io
Copy link

codecov-io commented Jun 19, 2019

Codecov Report

Merging #1361 into dev will increase coverage by <1%.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##            dev   #1361    +/-   ##
=====================================
+ Coverage    98%     98%   +<1%     
=====================================
  Files        36      36            
  Lines      5335    5338     +3     
=====================================
+ Hits       5229    5232     +3     
  Misses      106     106

Copy link
Contributor Author

@bozho bozho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 4 files reviewed, 2 unresolved discussions (waiting on @bozho and @johlju)


DSCResources/MSFT_SqlSetup/MSFT_SqlSetup.psm1, line 528 at r1 (raw file):

Previously, johlju (Johan Ljunggren) wrote…

We need to return the RSInstallMode property here. Can we detect the install mode from registry or by some other means?

I haven't found a way. This parameter is just telling the setup whether to initialise SSRS with defaults on install. I don't think it leaves a trace anywhere - we may be able to parse the setup log, but that seems brittle.


DSCResources/MSFT_SqlSetup/MSFT_SqlSetup.psm1, line 1457 at r1 (raw file):

Previously, johlju (Johan Ljunggren) wrote…
$setupArguments += @{ RSINSTALLMODE = $RSInstallMode}

We should test this line in a unit test.

Will do

Copy link
Contributor Author

@bozho bozho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 4 files reviewed, 2 unresolved discussions (waiting on @bozho and @johlju)


DSCResources/MSFT_SqlSetup/MSFT_SqlSetup.psm1, line 528 at r1 (raw file):

Previously, bozho (Marko Bozikovic) wrote…

I haven't found a way. This parameter is just telling the setup whether to initialise SSRS with defaults on install. I don't think it leaves a trace anywhere - we may be able to parse the setup log, but that seems brittle.

I've done a bit of digging and the only thing I can find is HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSRS13.MSSQLSERVER\Setup Registry key, with RSConfiguration value, but that one seems to store current SSRS configuration state.


DSCResources/MSFT_SqlSetup/MSFT_SqlSetup.psm1, line 1457 at r1 (raw file):

Previously, bozho (Marko Bozikovic) wrote…

Will do

Hm, since we can't seem to get this value from Get-TargetResource, what would we be unit testing here?

@johlju johlju added needs review The pull request needs a code review. and removed waiting for code fix A review left open comments, and the pull request is waiting for changes to be pushed by the author. labels Jun 19, 2019
Copy link
Member

@johlju johlju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 4 of 4 files at r2.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @bozho)


DSCResources/MSFT_SqlSetup/MSFT_SqlSetup.psm1, line 528 at r1 (raw file):

Previously, bozho (Marko Bozikovic) wrote…

I've done a bit of digging and the only thing I can find is HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSRS13.MSSQLSERVER\Setup Registry key, with RSConfiguration value, but that one seems to store current SSRS configuration state.

In that case, let us just add the RSInstallMode parameter to the Get-TargetResource so you can return the $RSInstallMode parameter in this hashtable.

return @{
    ...
    RSInstallMode = $RSInstallMode
}

DSCResources/MSFT_SqlSetup/MSFT_SqlSetup.psm1, line 1457 at r1 (raw file):

Previously, bozho (Marko Bozikovic) wrote…

Hm, since we can't seem to get this value from Get-TargetResource, what would we be unit testing here?

We have a test that verifies that the setup.exe is called with this argument. I think we could add the parameter and argument to these hashtables
https://github.com/PowerShell/SqlServerDsc/blob/e8298d59934eeaa68ce373afc683d2aefa579136/Tests/Unit/MSFT_SqlSetup.Tests.ps1#L2863-L2920

The mock for Start-SqlSetupProcess check the actual arguments against the expected arguments (using what I call a "dynamic mock").
https://github.com/PowerShell/SqlServerDsc/blob/e8298d59934eeaa68ce373afc683d2aefa579136/Tests/Unit/MSFT_SqlSetup.Tests.ps1#L915-L919

@johlju johlju changed the title [#1163] Added support for RSINSTALLMODE SQL Setup parameter SqlSetup: Added support for RSINSTALLMODE parameter Jun 19, 2019
@johlju johlju added waiting for code fix A review left open comments, and the pull request is waiting for changes to be pushed by the author. and removed needs review The pull request needs a code review. labels Jun 19, 2019
Copy link
Contributor Author

@bozho bozho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 3 of 5 files reviewed, 2 unresolved discussions (waiting on @johlju)


DSCResources/MSFT_SqlSetup/MSFT_SqlSetup.psm1, line 528 at r1 (raw file):

Previously, johlju (Johan Ljunggren) wrote…

In that case, let us just add the RSInstallMode parameter to the Get-TargetResource so you can return the $RSInstallMode parameter in this hashtable.

return @{
    ...
    RSInstallMode = $RSInstallMode
}

Done.


DSCResources/MSFT_SqlSetup/MSFT_SqlSetup.psm1, line 1457 at r1 (raw file):

Previously, johlju (Johan Ljunggren) wrote…

We have a test that verifies that the setup.exe is called with this argument. I think we could add the parameter and argument to these hashtables
https://github.com/PowerShell/SqlServerDsc/blob/e8298d59934eeaa68ce373afc683d2aefa579136/Tests/Unit/MSFT_SqlSetup.Tests.ps1#L2863-L2920

The mock for Start-SqlSetupProcess check the actual arguments against the expected arguments (using what I call a "dynamic mock").
https://github.com/PowerShell/SqlServerDsc/blob/e8298d59934eeaa68ce373afc683d2aefa579136/Tests/Unit/MSFT_SqlSetup.Tests.ps1#L915-L919

Done.

Copy link
Member

@johlju johlju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Waiting for the tests to pass.

Reviewed 2 of 2 files at r3.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

Copy link
Member

@johlju johlju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

@johlju johlju added ready for merge The pull request was approved by the community and is ready to be merged by a maintainer. and removed waiting for code fix A review left open comments, and the pull request is waiting for changes to be pushed by the author. labels Jun 19, 2019
@johlju johlju merged commit cc652c6 into dsccommunity:dev Jun 19, 2019
@johlju
Copy link
Member

johlju commented Jun 19, 2019

@bozho Thank you for this! Awesome to get this one over the finish line! Great work!

@johlju johlju removed the ready for merge The pull request was approved by the community and is ready to be merged by a maintainer. label Jun 19, 2019
@bozho bozho deleted the issue-1163-rs-install-mode branch March 26, 2020 08:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants