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

xSQLServerAlwaysOnAvailabilityGroupDatabaseMembership: Localization updates #663

Merged
merged 6 commits into from
Jul 3, 2017
Merged

xSQLServerAlwaysOnAvailabilityGroupDatabaseMembership: Localization updates #663

merged 6 commits into from
Jul 3, 2017

Conversation

randomnote1
Copy link
Contributor

@randomnote1 randomnote1 commented Jun 27, 2017

Pull Request (PR) description
Updated localization for xSQLServerAlwaysOnAvailabilityGroupDatabaseMembership.

This Pull Request (PR) fixes the following issues:
Fixes #660

Task list:

  • Change details added to Unreleased section of CHANGELOG.md?
  • Added/updated documentation, comment-based help and descriptions in .schema.mof files where appropriate?
  • Examples appropriately updated?
  • New/changed code adheres to Style Guidelines?
  • Unit and (optional) Integration tests created/updated where possible?

This change is Reviewable

@codecov-io
Copy link

codecov-io commented Jun 27, 2017

Codecov Report

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

Impacted file tree graph

@@         Coverage Diff          @@
##            dev   #663    +/-   ##
====================================
+ Coverage    97%    97%   +<1%     
====================================
  Files        30     30            
  Lines      3228   3232     +4     
====================================
+ Hits       3143   3147     +4     
  Misses       85     85

@johlju johlju added the needs review The pull request needs a code review. label Jun 30, 2017
@johlju
Copy link
Member

johlju commented Jun 30, 2017

I will try to get to this on on Sunday, or Monday at the latest.

@johlju
Copy link
Member

johlju commented Jun 30, 2017

Reviewed 4 of 5 files at r1, 1 of 1 files at r2.
Review status: all files reviewed at latest revision, 12 unresolved discussions.


DSCResources/MSFT_xSQLServerAlwaysOnAvailabilityGroupDatabaseMembership/MSFT_xSQLServerAlwaysOnAvailabilityGroupDatabaseMembership.psm1, line 79 at r2 (raw file):

        else
        {
            Write-Verbose -Message ($script:localizedData.AvailabilityGroupDoesNotExist -f $this.AvailabilityGroupName) -Verbose

You shouldn't need -Verbose on these in the resource (it's only a problem in the helper module).
So please remove all -Verbose from the Write-Verbose cmdlets throughout.


DSCResources/MSFT_xSQLServerAlwaysOnAvailabilityGroupDatabaseMembership/MSFT_xSQLServerAlwaysOnAvailabilityGroupDatabaseMembership.psm1, line 135 at r2 (raw file):

                        ( ( $impersonatePermissionsStatus.GetEnumerator() | Where-Object -FilterScript { -not $_.Value } | Select-Object -ExpandProperty Key ) -join ', ' )
                    )
                    throw ($script:localizedData.ImpersonatePermissionsMissing -f $impersonatePermissionsMissingParameters )

Could we use helper function New-InvalidOperationException to throw the error? In the CommonResourceHelper

PSDscResources using these helper functions. But I really don't mind using throw directly though.

What are your thoughts? (Maybe we should just remove these helper functions)


DSCResources/MSFT_xSQLServerAlwaysOnAvailabilityGroupDatabaseMembership/MSFT_xSQLServerAlwaysOnAvailabilityGroupDatabaseMembership.psm1, line 520 at r2 (raw file):

ParameterValidation

Should this be 'ServerObject'?


DSCResources/MSFT_xSQLServerAlwaysOnAvailabilityGroupDatabaseMembership/MSFT_xSQLServerAlwaysOnAvailabilityGroupDatabaseMembership.psm1, line 526 at r2 (raw file):

ParameterValidation

Should this be 'AvailabilityGroup'?


DSCResources/MSFT_xSQLServerAlwaysOnAvailabilityGroupDatabaseMembership/MSFT_xSQLServerAlwaysOnAvailabilityGroupDatabaseMembership.psm1, line 532 at r2 (raw file):

ParameterValidation

Should this be 'ServerObject'?


DSCResources/MSFT_xSQLServerAlwaysOnAvailabilityGroupDatabaseMembership/MSFT_xSQLServerAlwaysOnAvailabilityGroupDatabaseMembership.psm1, line 538 at r2 (raw file):

ParameterValidation

Should this be 'ServerObject'?


DSCResources/MSFT_xSQLServerAlwaysOnAvailabilityGroupDatabaseMembership/MSFT_xSQLServerAlwaysOnAvailabilityGroupDatabaseMembership.psm1, line 578 at r2 (raw file):

ParameterValidation

Should this be 'ServerObject'?


DSCResources/MSFT_xSQLServerAlwaysOnAvailabilityGroupDatabaseMembership/MSFT_xSQLServerAlwaysOnAvailabilityGroupDatabaseMembership.psm1, line 584 at r2 (raw file):

ParameterValidation

Should this be 'AvailabilityGroup'?


DSCResources/MSFT_xSQLServerAlwaysOnAvailabilityGroupDatabaseMembership/MSFT_xSQLServerAlwaysOnAvailabilityGroupDatabaseMembership.psm1, line 590 at r2 (raw file):

ParameterValidation

Should this be 'ServerObject'?


DSCResources/MSFT_xSQLServerAlwaysOnAvailabilityGroupDatabaseMembership/MSFT_xSQLServerAlwaysOnAvailabilityGroupDatabaseMembership.psm1, line 595 at r2 (raw file):

ParameterValidation

Should this be 'ServerObject'?


DSCResources/MSFT_xSQLServerAlwaysOnAvailabilityGroupDatabaseMembership/MSFT_xSQLServerAlwaysOnAvailabilityGroupDatabaseMembership.psm1, line 633 at r2 (raw file):

ParameterValidation

Should this be 'ServerObject'?


DSCResources/MSFT_xSQLServerAlwaysOnAvailabilityGroupDatabaseMembership/en-US/MSFT_xSQLServerAlwaysOnAvailabilityGroupDatabaseMembership.strings.psd1, line 11 at r2 (raw file):

    DatabasesNotFound = The following databases were not found in the instance: {0}.
    ImpersonatePermissionsMissing = The login '{0}' is missing impersonate permissions in the instances '{1}'.
    NoDatabasesFound = No databases found that match the name(s): {0}.

This is similar to 'DatabasesNotFound'. Can only this or the other be used?


Comments from Reviewable

@johlju johlju added waiting for author response The pull request is waiting for the author to respond to comments in the pull request. and removed needs review The pull request needs a code review. labels Jun 30, 2017
@randomnote1
Copy link
Contributor Author

Will wait to review the rest of the comments until you respond to my responses :)


Review status: all files reviewed at latest revision, 12 unresolved discussions.


DSCResources/MSFT_xSQLServerAlwaysOnAvailabilityGroupDatabaseMembership/MSFT_xSQLServerAlwaysOnAvailabilityGroupDatabaseMembership.psm1, line 79 at r2 (raw file):

Previously, johlju (Johan Ljunggren) wrote…

You shouldn't need -Verbose on these in the resource (it's only a problem in the helper module).
So please remove all -Verbose from the Write-Verbose cmdlets throughout.

Without the -Verbose flag, it did not show verbosity when the Pester tests were executed.


DSCResources/MSFT_xSQLServerAlwaysOnAvailabilityGroupDatabaseMembership/MSFT_xSQLServerAlwaysOnAvailabilityGroupDatabaseMembership.psm1, line 135 at r2 (raw file):

Previously, johlju (Johan Ljunggren) wrote…

Could we use helper function New-InvalidOperationException to throw the error? In the CommonResourceHelper

PSDscResources using these helper functions. But I really don't mind using throw directly though.

What are your thoughts? (Maybe we should just remove these helper functions)

I had considered using that, but I don't think this is an invalid operation. To me this is more of a security error in the fact that permissions are missing.


DSCResources/MSFT_xSQLServerAlwaysOnAvailabilityGroupDatabaseMembership/MSFT_xSQLServerAlwaysOnAvailabilityGroupDatabaseMembership.psm1, line 520 at r2 (raw file):

Previously, johlju (Johan Ljunggren) wrote…

ParameterValidation

Should this be 'ServerObject'?

For the ArgumentName? The parameter 'ServerObject' is covered in the error message. Maybe I'm not understanding how New-InvalidArgumentException is intended to be used.


DSCResources/MSFT_xSQLServerAlwaysOnAvailabilityGroupDatabaseMembership/en-US/MSFT_xSQLServerAlwaysOnAvailabilityGroupDatabaseMembership.strings.psd1, line 11 at r2 (raw file):

Previously, johlju (Johan Ljunggren) wrote…

This is similar to 'DatabasesNotFound'. Can only this or the other be used?

Yeah, I was trying to differentiate between not find any databases and not finding a subset. Concur that it's redundant.
Done


Comments from Reviewable

@johlju
Copy link
Member

johlju commented Jul 1, 2017

Reviewed 2 of 2 files at r3.
Review status: all files reviewed at latest revision, 11 unresolved discussions.


DSCResources/MSFT_xSQLServerAlwaysOnAvailabilityGroupDatabaseMembership/MSFT_xSQLServerAlwaysOnAvailabilityGroupDatabaseMembership.psm1, line 79 at r2 (raw file):

Previously, randomnote1 (Dan Reist) wrote…

Without the -Verbose flag, it did not show verbosity when the Pester tests were executed.

That is the correct behaviour when Pester runs. It's wrong of us to have forced the verbose messages before. They will be shown correctly if the user adds -Verbose to for example Start-DscConfiguration.


DSCResources/MSFT_xSQLServerAlwaysOnAvailabilityGroupDatabaseMembership/MSFT_xSQLServerAlwaysOnAvailabilityGroupDatabaseMembership.psm1, line 135 at r2 (raw file):

Previously, randomnote1 (Dan Reist) wrote…

I had considered using that, but I don't think this is an invalid operation. To me this is more of a security error in the fact that permissions are missing.

Then this looks good to me. Leave it as-is.


DSCResources/MSFT_xSQLServerAlwaysOnAvailabilityGroupDatabaseMembership/MSFT_xSQLServerAlwaysOnAvailabilityGroupDatabaseMembership.psm1, line 520 at r2 (raw file):

Previously, randomnote1 (Dan Reist) wrote…

For the ArgumentName? The parameter 'ServerObject' is covered in the error message. Maybe I'm not understanding how New-InvalidArgumentException is intended to be used.

That particular helper function will return a standard parameter error message saying that the specific argument/parameter (which is provided in ArgumentName) was not correct and the error message should explain why and how to resolve.

https://msdn.microsoft.com/en-us/library/sxykka64(v=vs.110).aspx


Comments from Reviewable

@randomnote1
Copy link
Contributor Author

Review status: 2 of 5 files reviewed at latest revision, 11 unresolved discussions.


DSCResources/MSFT_xSQLServerAlwaysOnAvailabilityGroupDatabaseMembership/MSFT_xSQLServerAlwaysOnAvailabilityGroupDatabaseMembership.psm1, line 79 at r2 (raw file):

Previously, johlju (Johan Ljunggren) wrote…

That is the correct behaviour when Pester runs. It's wrong of us to have forced the verbose messages before. They will be shown correctly if the user adds -Verbose to for example Start-DscConfiguration.

Done.
Should we be testing the verbose message output? I think that would require mocking Write-Verbose.


DSCResources/MSFT_xSQLServerAlwaysOnAvailabilityGroupDatabaseMembership/MSFT_xSQLServerAlwaysOnAvailabilityGroupDatabaseMembership.psm1, line 135 at r2 (raw file):

Previously, johlju (Johan Ljunggren) wrote…

Then this looks good to me. Leave it as-is.

Done.


DSCResources/MSFT_xSQLServerAlwaysOnAvailabilityGroupDatabaseMembership/MSFT_xSQLServerAlwaysOnAvailabilityGroupDatabaseMembership.psm1, line 520 at r2 (raw file):

Previously, johlju (Johan Ljunggren) wrote…

That particular helper function will return a standard parameter error message saying that the specific argument/parameter (which is provided in ArgumentName) was not correct and the error message should explain why and how to resolve.

https://msdn.microsoft.com/en-us/library/sxykka64(v=vs.110).aspx

Done.


DSCResources/MSFT_xSQLServerAlwaysOnAvailabilityGroupDatabaseMembership/MSFT_xSQLServerAlwaysOnAvailabilityGroupDatabaseMembership.psm1, line 526 at r2 (raw file):

Previously, johlju (Johan Ljunggren) wrote…

ParameterValidation

Should this be 'AvailabilityGroup'?

Done.


DSCResources/MSFT_xSQLServerAlwaysOnAvailabilityGroupDatabaseMembership/MSFT_xSQLServerAlwaysOnAvailabilityGroupDatabaseMembership.psm1, line 532 at r2 (raw file):

Previously, johlju (Johan Ljunggren) wrote…

ParameterValidation

Should this be 'ServerObject'?

Done.


DSCResources/MSFT_xSQLServerAlwaysOnAvailabilityGroupDatabaseMembership/MSFT_xSQLServerAlwaysOnAvailabilityGroupDatabaseMembership.psm1, line 538 at r2 (raw file):

Previously, johlju (Johan Ljunggren) wrote…

ParameterValidation

Should this be 'ServerObject'?

Should actually be AvailabilityGroup.
Done.


DSCResources/MSFT_xSQLServerAlwaysOnAvailabilityGroupDatabaseMembership/MSFT_xSQLServerAlwaysOnAvailabilityGroupDatabaseMembership.psm1, line 578 at r2 (raw file):

Previously, johlju (Johan Ljunggren) wrote…

ParameterValidation

Should this be 'ServerObject'?

Done.


DSCResources/MSFT_xSQLServerAlwaysOnAvailabilityGroupDatabaseMembership/MSFT_xSQLServerAlwaysOnAvailabilityGroupDatabaseMembership.psm1, line 584 at r2 (raw file):

Previously, johlju (Johan Ljunggren) wrote…

ParameterValidation

Should this be 'AvailabilityGroup'?

Done.


DSCResources/MSFT_xSQLServerAlwaysOnAvailabilityGroupDatabaseMembership/MSFT_xSQLServerAlwaysOnAvailabilityGroupDatabaseMembership.psm1, line 590 at r2 (raw file):

Previously, johlju (Johan Ljunggren) wrote…

ParameterValidation

Should this be 'ServerObject'?

Done.


DSCResources/MSFT_xSQLServerAlwaysOnAvailabilityGroupDatabaseMembership/MSFT_xSQLServerAlwaysOnAvailabilityGroupDatabaseMembership.psm1, line 595 at r2 (raw file):

Previously, johlju (Johan Ljunggren) wrote…

ParameterValidation

Should this be 'ServerObject'?

Should be 'AvailabilityGroup'.
Done.


DSCResources/MSFT_xSQLServerAlwaysOnAvailabilityGroupDatabaseMembership/MSFT_xSQLServerAlwaysOnAvailabilityGroupDatabaseMembership.psm1, line 633 at r2 (raw file):

Previously, johlju (Johan Ljunggren) wrote…

ParameterValidation

Should this be 'ServerObject'?

Done.


Comments from Reviewable

@johlju johlju added needs review The pull request needs a code review. and removed waiting for author response The pull request is waiting for the author to respond to comments in the pull request. labels Jul 3, 2017
@johlju
Copy link
Member

johlju commented Jul 3, 2017

Reviewed 3 of 3 files at r4.
Review status: all files reviewed at latest revision, 1 unresolved discussion.


DSCResources/MSFT_xSQLServerAlwaysOnAvailabilityGroupDatabaseMembership/MSFT_xSQLServerAlwaysOnAvailabilityGroupDatabaseMembership.psm1, line 79 at r2 (raw file):

Previously, randomnote1 (Dan Reist) wrote…

Done.
Should we be testing the verbose message output? I think that would require mocking Write-Verbose.

I haven't thought about that. I haven't seen anyone do that, testing verbose output, maybe because it's optional, and because it is not a specific code path. Do you see a good reason to add that? Otherwise I think we leave that out for now. 😄


Comments from Reviewable

@johlju johlju added waiting for author response The pull request is waiting for the author to respond to comments in the pull request. and removed needs review The pull request needs a code review. labels Jul 3, 2017
@johlju
Copy link
Member

johlju commented Jul 3, 2017

@randomnote1 Waiting for you to reply or acknowledge that last comment. After that we can merge.

@randomnote1
Copy link
Contributor Author

Review status: :shipit: all files reviewed at latest revision, all discussions resolved, all commit checks successful.


DSCResources/MSFT_xSQLServerAlwaysOnAvailabilityGroupDatabaseMembership/MSFT_xSQLServerAlwaysOnAvailabilityGroupDatabaseMembership.psm1, line 79 at r2 (raw file):

Previously, johlju (Johan Ljunggren) wrote…

I haven't thought about that. I haven't seen anyone do that, testing verbose output, maybe because it's optional, and because it is not a specific code path. Do you see a good reason to add that? Otherwise I think we leave that out for now. 😄

Verbose messages are how we convey information to the end user. Often time the verbose messages combined with the error messages allow the end user to more easily troubleshoot their configurations.

Additionally, with the focus on localization, it might be smart to test the localization paths. I don't really want to add the additional work, but it should ensure higher quality work in the end.

At the very least, something to discuss on the calls!


Comments from Reviewable

@johlju
Copy link
Member

johlju commented Jul 3, 2017

Review status: all files reviewed at latest revision, 1 unresolved discussion, all commit checks successful.


DSCResources/MSFT_xSQLServerAlwaysOnAvailabilityGroupDatabaseMembership/MSFT_xSQLServerAlwaysOnAvailabilityGroupDatabaseMembership.psm1, line 79 at r2 (raw file):

Previously, randomnote1 (Dan Reist) wrote…

Verbose messages are how we convey information to the end user. Often time the verbose messages combined with the error messages allow the end user to more easily troubleshoot their configurations.

Additionally, with the focus on localization, it might be smart to test the localization paths. I don't really want to add the additional work, but it should ensure higher quality work in the end.

At the very least, something to discuss on the calls!

I agree with you. And I don't mind the extra work, if it gives us higher quality.

Could you please submit an issue to DscResources repo so we could reference that in the calls? In the end it's probably up to each repo. But maybe we could get a common test guideline around this.


Comments from Reviewable

@johlju
Copy link
Member

johlju commented Jul 3, 2017

:lgtm:


Review status: :shipit: all files reviewed at latest revision, all discussions resolved, all commit checks successful.


Comments from Reviewable

@johlju johlju removed the waiting for author response The pull request is waiting for the author to respond to comments in the pull request. label Jul 3, 2017
@johlju johlju merged commit 67bf54a into dsccommunity:dev Jul 3, 2017
@randomnote1
Copy link
Contributor Author

DSCResources/MSFT_xSQLServerAlwaysOnAvailabilityGroupDatabaseMembership/MSFT_xSQLServerAlwaysOnAvailabilityGroupDatabaseMembership.psm1, line 79 at r2 (raw file):

Previously, johlju (Johan Ljunggren) wrote…

I agree with you. And I don't mind the extra work, if it gives us higher quality.

Could you please submit an issue to DscResources repo so we could reference that in the calls? In the end it's probably up to each repo. But maybe we could get a common test guideline around this.

Opened issue PowerShell/DscResources#290


Comments from Reviewable

@randomnote1 randomnote1 deleted the xSQLServerAlwaysOnAvailabilityGroupDatabaseMembership-Localization branch July 4, 2017 02:09
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.

xSQLServerAlwaysOnAvailabilityGroupDatabaseMembership: Localization should change to align with HQRM modules
4 participants