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

SqlServerDsc: Improvement to how Import-SQLPSModule import module #1175

Merged
merged 2 commits into from
Jul 7, 2018

Conversation

johlju
Copy link
Member

@johlju johlju commented Jul 6, 2018

Pull Request (PR) description

  • Changes to SqlServerDsc
    • Updated helper function Import-SQLPSModule
      • To only import module if the
        module does not exist in the session.
      • To always import the latest version of 'SqlServer' or 'SQLPS' module, if
        more than one version exist on the target node. It will still prefer to
        use 'SqlServer' module.
    • Changes to SqlAG
      • Removed excess Import-SQLPSModule call.
    • Changes to SqlSetup
      • Now after a successful install the "SQL PowerShell module" is reevaluated and
        forced to be reimported into the session. This is to support that a never
        version of SQL Server was installed side-by-side so that SQLPS module should
        be used instead.

This Pull Request (PR) fixes the following issues

Helps with issue #1151

Task list

  • Added an entry under the Unreleased section 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

- Updated helper function `Import-SQLPSModule`
  - To only import module if the
    module does not exist in the session.
  - To always import the latest version of 'SqlServer' or 'SQLPS' module, if
    more than one version exist on the target node. It will still prefer to
    use 'SqlServer' module.
- Changes to SqlAG
  - Removed excess `Import-SQLPSModule` call.
- Changes to SqlSetup
  - Now after a successful install the "SQL PowerShell module" is reevaluated and
    forced to be reimported into the session. This is to support that a never
    version of SQL Server was installed side-by-side so that SQLPS module should
    be used instead.
@johlju johlju added the needs review The pull request needs a code review. label Jul 6, 2018
Copy link
Member Author

@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 3 of 9 files at r1.
Reviewable status: 3 of 9 files reviewed, all discussions resolved

@codecov-io
Copy link

codecov-io commented Jul 6, 2018

Codecov Report

Merging #1175 into dev will increase coverage by <1%.
The diff coverage is 93%.

Impacted file tree graph

@@          Coverage Diff          @@
##            dev   #1175    +/-   ##
=====================================
+ Coverage    97%     97%   +<1%     
=====================================
  Files        33      33            
  Lines      3994    4012    +18     
=====================================
+ Hits       3907    3925    +18     
  Misses       87      87

Copy link
Member Author

@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 6 of 9 files at r1.
Reviewable status: all files reviewed, 1 unresolved discussion


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

if newer version was installed.

"...in case a newer version was installed"

Copy link
Member Author

@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 1 of 1 files at r2.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved


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

Previously, johlju (Johan Ljunggren) wrote…
if newer version was installed.

"...in case a newer version was installed"

Done

Copy link
Member Author

@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:

Merging this when the tests passes.

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

@johlju
Copy link
Member Author

johlju commented Jul 7, 2018

Closing and reopening to kick off the tests igen (resolved bug in the test framework that cause the test from failing)

@johlju johlju closed this Jul 7, 2018
@johlju johlju removed the needs review The pull request needs a code review. label Jul 7, 2018
@johlju johlju reopened this Jul 7, 2018
@johlju johlju added the needs review The pull request needs a code review. label Jul 7, 2018
@johlju johlju merged commit ac284e9 into dsccommunity:dev Jul 7, 2018
@johlju johlju removed the needs review The pull request needs a code review. label Jul 7, 2018
@johlju johlju deleted the fix-import-module branch July 7, 2018 15:22
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.

2 participants