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

ADReplicationSiteLink: Fix Setting Options After the Resource is Initially Created #606

Merged

Conversation

X-Guardian
Copy link
Contributor

@X-Guardian X-Guardian commented Apr 27, 2020

Pull Request (PR) description

This PR fixes the issue with the ADReplicationSiteLink resource whereby setting OptionChangeNotification, OptionTwoWaySync or OptionDisableCompression fails after the resource is initially created.

This Pull Request (PR) fixes the following issues

Task list

  • Added an entry to the change log under the Unreleased section of the
    file CHANGELOG.md. Entry should say what was changed and how that
    affects users (if applicable), and reference the issue being resolved
    (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 Community Testing Guidelines.
  • Integration tests added/updated (where possible). See DSC Community Testing Guidelines.
  • New/changed code adheres to DSC Community Style Guidelines.

This change is Reviewable

@X-Guardian X-Guardian marked this pull request as ready for review April 28, 2020 07:12
@X-Guardian X-Guardian added the needs review The pull request needs a code review. label Apr 28, 2020
@X-Guardian X-Guardian requested a review from johlju April 28, 2020 07:12
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 1 of 3 files at r1.
Reviewable status: 1 of 3 files reviewed, 1 unresolved discussion (waiting on @johlju and @X-Guardian)


source/DSCResources/MSFT_ADReplicationSiteLink/MSFT_ADReplicationSiteLink.psm1, line 292 at r1 (raw file):

if ($PSBoundParameters.ContainsKey('OptionChangeNotification') 

This was used to only change this property if it was passed in the configuration (if the value should be enforced on an existing site link). With this change it looks like the resource will always be changed regardless if the configuration wanted to enforce that value or not.

If the values need to be set when initially creating the site link, then that should be separate logic from enforcing an existing site link?

@johlju johlju self-requested a review April 28, 2020 07:41
@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 Apr 28, 2020
Copy link
Contributor Author

@X-Guardian X-Guardian 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: 1 of 3 files reviewed, 1 unresolved discussion (waiting on @johlju)


source/DSCResources/MSFT_ADReplicationSiteLink/MSFT_ADReplicationSiteLink.psm1, line 292 at r1 (raw file):

Previously, johlju (Johan Ljunggren) wrote…
if ($PSBoundParameters.ContainsKey('OptionChangeNotification') 

This was used to only change this property if it was passed in the configuration (if the value should be enforced on an existing site link). With this change it looks like the resource will always be changed regardless if the configuration wanted to enforce that value or not.

If the values need to be set when initially creating the site link, then that should be separate logic from enforcing an existing site link?

The parameters have a default value, which we should be applying if not specified in the config, which is what this change does. If we don't want them to have a default value, we should remove the defaults from the parameter definitions.

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.

Reviewable status: 1 of 3 files reviewed, 1 unresolved discussion (waiting on @johlju and @X-Guardian)


source/DSCResources/MSFT_ADReplicationSiteLink/MSFT_ADReplicationSiteLink.psm1, line 292 at r1 (raw file):

Previously, X-Guardian (Simon Heather) wrote…

The parameters have a default value, which we should be applying if not specified in the config, which is what this change does. If we don't want them to have a default value, we should remove the defaults from the parameter definitions.

I think we should remove the default values, because I think we should only enforce values that is part of a configuration. The proposed change would be a breaking change since it will start enforcing values not in an existing configuration. If we remove the default values then this would not be a breaking change. 🤔

What do you think?

@johlju johlju self-requested a review April 28, 2020 14:29
Copy link
Contributor Author

@X-Guardian X-Guardian 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: 1 of 3 files reviewed, 1 unresolved discussion (waiting on @johlju)


source/DSCResources/MSFT_ADReplicationSiteLink/MSFT_ADReplicationSiteLink.psm1, line 292 at r1 (raw file):

Previously, johlju (Johan Ljunggren) wrote…

I think we should remove the default values, because I think we should only enforce values that is part of a configuration. The proposed change would be a breaking change since it will start enforcing values not in an existing configuration. If we remove the default values then this would not be a breaking change. 🤔

What do you think?

Agreed, Johan. We shouldn't have non-required properties with default values, as it is confusing as to whether they are 'managed' properties or not. I'll remove the default values and refactor the code.

Copy link
Contributor Author

@X-Guardian X-Guardian 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: 1 of 3 files reviewed, 1 unresolved discussion (waiting on @johlju)


source/DSCResources/MSFT_ADReplicationSiteLink/MSFT_ADReplicationSiteLink.psm1, line 292 at r1 (raw file):

Previously, X-Guardian (Simon Heather) wrote…

Agreed, Johan. We shouldn't have non-required properties with default values, as it is confusing as to whether they are 'managed' properties or not. I'll remove the default values and refactor the code.

Done.

@X-Guardian X-Guardian 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 Apr 29, 2020
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:

Reviewed 1 of 3 files at r1, 1 of 1 files at r2.
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 needs review The pull request needs a code review. labels May 2, 2020
@codecov
Copy link

codecov bot commented May 2, 2020

Codecov Report

Merging #606 into master will increase coverage by 0%.
The diff coverage is 98%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #606   +/-   ##
=====================================
  Coverage      98%    99%           
=====================================
  Files          23     23           
  Lines        3093   3045   -48     
=====================================
- Hits         3059   3031   -28     
+ Misses         34     14   -20     

@X-Guardian X-Guardian merged commit 1862dc7 into dsccommunity:master May 2, 2020
@X-Guardian X-Guardian deleted the ADReplicationSiteLink-Options-Fix branch May 2, 2020 12:24
@X-Guardian X-Guardian removed the ready for merge The pull request was approved by the community and is ready to be merged by a maintainer. label May 2, 2020
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.

ADReplicationSiteLink: Fails to Set Options After the Resource is Initially Created
2 participants