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
New resource xADForestProperties (Fixes #177) #178
Conversation
Codecov Report
@@ Coverage Diff @@
## dev #178 +/- ##
====================================
+ Coverage 82% 84% +1%
====================================
Files 15 16 +1
Lines 1333 1433 +100
Branches 10 10
====================================
+ Hits 1106 1206 +100
Misses 217 217
Partials 10 10 |
I will help and review this one in a couple of days or so, if someone haven't until then, |
Reviewed 3 of 5 files at r1, 2 of 2 files at r2. a discussion (no related file): README.md, line 257 at r2 (raw file):
Discussion about the name in the resource is ongoing in the issue #177. Depending on name change the resource description might need to change a little. README.md, line 261 at r2 (raw file):
We should add '.' at the end of the sentence here. README.md, line 262 at r2 (raw file):
Maybe we could change this to 'Specifies one or more User...' since it is an array. README.md, line 262 at r2 (raw file):
Nitpick (non-blocking): Could we have README.md, line 263 at r2 (raw file):
Maybe we could change this to 'Specifies one or more Service...' since it is an array. README.md, line 264 at r2 (raw file):
Seems a double-quote sneaked in here at the beginning or the sentence. README.md, line 1205 at r2 (raw file):
I think this description is not correct of what the example actually does? README.md, line 1243 at r2 (raw file):
Could we change this to README.md, line 1244 at r2 (raw file):
Could we use single-quotes here instead, to be consistent? Throughout. We try to avoid using double-quotes where it's not needed (in HQRM). There is not actual guideline for this apparently so I leave this non-blocking. DSCResources/MSFT_xADPrincipalNameSuffix/MSFT_xADPrincipalNameSuffix.psm1, line 22 at r2 (raw file):
Could you please add comment-based help? Throughout. DSCResources/MSFT_xADPrincipalNameSuffix/MSFT_xADPrincipalNameSuffix.psm1, line 45 at r2 (raw file):
Could we use single-quotes here instead, to be consistent? Throughout. We try to avoid using double-quotes where it's not needed (in HQRM). There is not actual guideline for this apparently so I leave this non-blocking. DSCResources/MSFT_xADPrincipalNameSuffix/MSFT_xADPrincipalNameSuffix.psm1, line 61 at r2 (raw file):
This will return the state as 'Present' or 'Absent' even if it isn't. Could we evaluate if the values are actually in desired state and return the actual state? DSCResources/MSFT_xADPrincipalNameSuffix/MSFT_xADPrincipalNameSuffix.psm1, line 101 at r2 (raw file):
We should use a space between keyword and parenthesis; DSCResources/MSFT_xADPrincipalNameSuffix/MSFT_xADPrincipalNameSuffix.psm1, line 105 at r2 (raw file):
Can we have a logical error here 🤔 What happens in this scenario.
Same for SPN below. DSCResources/MSFT_xADPrincipalNameSuffix/MSFT_xADPrincipalNameSuffix.psm1, line 141 at r2 (raw file):
Should be DSCResources/MSFT_xADPrincipalNameSuffix/MSFT_xADPrincipalNameSuffix.psm1, line 152 at r2 (raw file):
Should be DSCResources/MSFT_xADPrincipalNameSuffix/MSFT_xADPrincipalNameSuffix.psm1, line 160 at r2 (raw file):
Same as previous comment. DSCResources/MSFT_xADPrincipalNameSuffix/MSFT_xADPrincipalNameSuffix.psm1, line 200 at r2 (raw file):
Could we change this to DSCResources/MSFT_xADPrincipalNameSuffix/MSFT_xADPrincipalNameSuffix.psm1, line 200 at r2 (raw file):
Please change the hash tables according to the style guideline. Throughout. DSCResources/MSFT_xADPrincipalNameSuffix/MSFT_xADPrincipalNameSuffix.psm1, line 208 at r2 (raw file):
If we use replace, that means any manually added suffixes will me removed? If so, maybe we should add only the one that is missing? If we should have the option of replacing all in the forest, then maybe we should have three parameters;
DSCResources/MSFT_xADPrincipalNameSuffix/MSFT_xADPrincipalNameSuffix.schema.mof, line 4 at r2 (raw file):
Could we add a '.' to the end of the sentence (for the description)? DSCResources/MSFT_xADPrincipalNameSuffix/en-us/MSFT_xADPrincipalNameSuffix.strings.psd1, line 4 at r2 (raw file):
Could we add '...for forest '{0}'...', because it's nearly identical to the text in DSCResources/MSFT_xADPrincipalNameSuffix/en-us/MSFT_xADPrincipalNameSuffix.strings.psd1, line 5 at r2 (raw file):
Same as previous comment. Tests/Unit/MSFT_xADPrincipalNameSuffix.Tests.ps1, line 1 at r2 (raw file):
Should be Tests/Unit/MSFT_xADPrincipalNameSuffix.Tests.ps1, line 20 at r2 (raw file):
Can we remove this extra blank line? Tests/Unit/MSFT_xADPrincipalNameSuffix.Tests.ps1, line 24 at r2 (raw file):
Please use camelCase on local variables; Tests/Unit/MSFT_xADPrincipalNameSuffix.Tests.ps1, line 34 at r2 (raw file):
Can we remove this extra blank line? Tests/Unit/MSFT_xADPrincipalNameSuffix.Tests.ps1, line 47 at r2 (raw file):
Please use named parameters. Tests/Unit/MSFT_xADPrincipalNameSuffix.Tests.ps1, line 47 at r2 (raw file):
This parameter is not necessary when there is no need to mock with any code. Throughout. Tests/Unit/MSFT_xADPrincipalNameSuffix.Tests.ps1, line 56 at r2 (raw file):
Nitpick: This could be changed to Tests/Unit/MSFT_xADPrincipalNameSuffix.Tests.ps1, line 60 at r2 (raw file):
We try to write these as Tests/Unit/MSFT_xADPrincipalNameSuffix.Tests.ps1, line 73 at r2 (raw file):
Can we remove this extra blank line? Tests/Unit/MSFT_xADPrincipalNameSuffix.Tests.ps1, line 80 at r2 (raw file):
Typo here, I think it should be 'match'? Tests/Unit/MSFT_xADPrincipalNameSuffix.Tests.ps1, line 105 at r2 (raw file):
Please used named parameters Tests/Unit/MSFT_xADPrincipalNameSuffix.Tests.ps1, line 109 at r2 (raw file):
Can we change this to Tests/Unit/MSFT_xADPrincipalNameSuffix.Tests.ps1, line 117 at r2 (raw file):
Can we change this to Comments from Reviewable |
@johlju Thanks for the review, I'll make those updates early this week. |
@regedit32 Have you had the chance to look at the review comments? This PR also needs to be rebase against dev (using |
Thanks @johlju . I started making the changes, but it ended up being a larger rework and I haven't had a chance to get back to it. |
@regedit32 No worries, then I know you are still active on this PR. I will wait for you to update the review comments once you are done. 🙂 |
@regedit32 don't want to rush you in any way, just checking in since it was a month since the last update. Do you see you have a chance to continue the work on this PR? |
@johlju I hope to eventually get back to this and make the changes, but it's a little off my radar at the moment. |
@regedit32 Thanks for the update! |
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. |
94d4610
to
aee63bc
Compare
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.
Made a lot of changes to the resource and test since I last visited 😄 . Also added example files.
Reviewable status: 0 of 7 files reviewed, 33 unresolved discussions (waiting on @johlju and @regedit32)
a discussion (no related file):
Previously, johlju (Johan Ljunggren) wrote…
Could you please add
Fixes #177
to the PR description, or PR title, so that the issue auto-closes on merge.
Done.
README.md, line 257 at r2 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
xADPrincipalNameSuffix
Discussion about the name in the resource is ongoing in the issue #177. Depending on name change the resource description might need to change a little.
Done.
README.md, line 261 at r2 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
We should add '.' at the end of the sentence here.
Done.
README.md, line 262 at r2 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
Specifies the User Principal Name (UPN)
Maybe we could change this to 'Specifies one or more User...' since it is an array.
Changed description to say 'suffix(es)'
README.md, line 263 at r2 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
Specifies the Service Principal Name (SPN)
Maybe we could change this to 'Specifies one or more Service...' since it is an array.
Changed description to say 'suffix(es)'
README.md, line 264 at r2 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
"Specifies
Seems a double-quote sneaked in here at the beginning or the sentence.
Done.
README.md, line 1205 at r2 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
I think this description is not correct of what the example actually does?
Done.
README.md, line 1243 at r2 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
$params
Could we change this to
$parameters
to avoid abbreviations?
Done.
DSCResources/MSFT_xADPrincipalNameSuffix/MSFT_xADPrincipalNameSuffix.psm1, line 22 at r2 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
Could you please add comment-based help? Throughout.
Done.
DSCResources/MSFT_xADPrincipalNameSuffix/MSFT_xADPrincipalNameSuffix.psm1, line 61 at r2 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
This will return the state as 'Present' or 'Absent' even if it isn't. Could we evaluate if the values are actually in desired state and return the actual state?
Ensure no longer used due to other changes
DSCResources/MSFT_xADPrincipalNameSuffix/MSFT_xADPrincipalNameSuffix.psm1, line 101 at r2 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
if(
We should use a space between keyword and parenthesis;
if (
. Throughout.
Done.
DSCResources/MSFT_xADPrincipalNameSuffix/MSFT_xADPrincipalNameSuffix.psm1, line 105 at r2 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
Can we have a logical error here 🤔
What happens in this scenario.
- If the user want's to add UPN 'a' and there are no UPN's yet, LCM will run and this will correctly be false (different).
- Next time LCM runs, the user still wants want's to add UPN 'a' and now there is a UPN 'a' already, this will correctly be $true (same).
- Another user manually adds UPN 'b' to the forest.
- LCM runs and user still wants want's to add only UPN 'a', and now there is a UPN 'a' and 'b' - won't this wrongly be false (different) and will set
$inDesiredState = $false
and try to runSet-TargetResource
?Same for SPN below.
Updated to allow keeping existing suffix(es)
DSCResources/MSFT_xADPrincipalNameSuffix/MSFT_xADPrincipalNameSuffix.psm1, line 141 at r2 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
ForestSPNSuffixNotInDesiredState
Should be
ForestSpnSuffixNotInDesiredState
(Pascal Case), the same as it is in the strings-file already.
Done.
DSCResources/MSFT_xADPrincipalNameSuffix/MSFT_xADPrincipalNameSuffix.psm1, line 152 at r2 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
SPNSuffixNotInDesiredState
Should be
SpnSuffixNotInDesiredState
(Pascal Case), the same as it is in the strings-file already.
Done.
DSCResources/MSFT_xADPrincipalNameSuffix/MSFT_xADPrincipalNameSuffix.psm1, line 160 at r2 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
Same as previous comment.
Done.
DSCResources/MSFT_xADPrincipalNameSuffix/MSFT_xADPrincipalNameSuffix.psm1, line 200 at r2 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
$setParams
Could we change this to
$setADForestParameters
to avoid abbreviations and more clearly show what parameters we are building (especially when reviewing 😄)?
Done.
DSCResources/MSFT_xADPrincipalNameSuffix/MSFT_xADPrincipalNameSuffix.psm1, line 200 at r2 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
@{Identity = $ForestName}
Please change the hash tables according to the style guideline. Throughout.
Done.
DSCResources/MSFT_xADPrincipalNameSuffix/MSFT_xADPrincipalNameSuffix.psm1, line 208 at r2 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
If we use replace, that means any manually added suffixes will me removed? If so, maybe we should add only the one that is missing?
If we should have the option of replacing all in the forest, then maybe we should have three parameters;
UserPrincipalNameSuffix
- This we replace all UPN in the forest. Cannot be used at the same time asUserPrincipalNameSuffixToInclude
andUserPrincipalNameSuffixToExclude
UserPrincipalNameSuffixToInclude
- This add only these UPN's. Can be used at the same time asUserPrincipalNameSuffixToExclude
.UserPrincipalNameSuffixToExclude
- This will remove only these UPN's. Can be used at the same time asUserPrincipalNameSuffixToInclude
Done.
DSCResources/MSFT_xADPrincipalNameSuffix/MSFT_xADPrincipalNameSuffix.schema.mof, line 4 at r2 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
Could we add a '.' to the end of the sentence (for the description)?
Done.
Tests/Unit/MSFT_xADPrincipalNameSuffix.Tests.ps1, line 1 at r2 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
$Global:
Should be
$global
(lower-.case 'g'). Throughout.
https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#script-environment-and-global-variable-names-include-scope
Done, but also changed to script scope
Tests/Unit/MSFT_xADPrincipalNameSuffix.Tests.ps1, line 20 at r2 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
Can we remove this extra blank line?
Done.
Tests/Unit/MSFT_xADPrincipalNameSuffix.Tests.ps1, line 24 at r2 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
$testpresentParams
Please use camelCase on local variables;
$testPresentParams
(upper 'P'). Throughout.
Done.
Tests/Unit/MSFT_xADPrincipalNameSuffix.Tests.ps1, line 34 at r2 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
Can we remove this extra blank line?
Done.
Tests/Unit/MSFT_xADPrincipalNameSuffix.Tests.ps1, line 47 at r2 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
Mock Assert-Module
Please use named parameters.
Mock -CommandName Assert-Module
. Throughout.
Done.
Tests/Unit/MSFT_xADPrincipalNameSuffix.Tests.ps1, line 47 at r2 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
-MockWith { }
This parameter is not necessary when there is no need to mock with any code. Throughout.
Done.
Tests/Unit/MSFT_xADPrincipalNameSuffix.Tests.ps1, line 60 at r2 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
Should be
We try to write these as
Should Be
(upper 'B') , or in the new Pester v4 formatShould -Be
. Throughout.
Done.
Tests/Unit/MSFT_xADPrincipalNameSuffix.Tests.ps1, line 73 at r2 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
Can we remove this extra blank line?
Done.
Tests/Unit/MSFT_xADPrincipalNameSuffix.Tests.ps1, line 80 at r2 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
matche
Typo here, I think it should be 'match'?
Done.
Tests/Unit/MSFT_xADPrincipalNameSuffix.Tests.ps1, line 105 at r2 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
Please used named parameters
-CommandName
. Also, it wouldn't hurt if we add-Exactly -Times 1
to know that it is actually called so many times as expected. Throughout.
Done.
Tests/Unit/MSFT_xADPrincipalNameSuffix.Tests.ps1, line 109 at r2 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
.replace
Can we change this to
.Replace
. Upper 'R'. Throughout.
Done.
Tests/Unit/MSFT_xADPrincipalNameSuffix.Tests.ps1, line 117 at r2 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
.remove
Can we change this to
.Remove
. Upper 'R'. Throughout.
Done.
DSCResources/MSFT_xADPrincipalNameSuffix/en-us/MSFT_xADPrincipalNameSuffix.strings.psd1, line 4 at r2 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
User Principal Name Suffix for '{0}' not in the desired state.
Could we add '...for forest '{0}'...', because it's nearly identical to the text in
UpnSuffixNotInDesiredState
.
Done.
DSCResources/MSFT_xADPrincipalNameSuffix/en-us/MSFT_xADPrincipalNameSuffix.strings.psd1, line 5 at r2 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
Same as previous comment.
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 11 of 11 files at r3.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @johlju and @regedit32)
DSCResources/MSFT_xADForestProperties/MSFT_xADForestProperties.psm1, line 107 at r3 (raw file):
[Array]$forest.UpnSuffixes
We should have a space between the type and the variable name. Throughout.
DSCResources/MSFT_xADForestProperties/MSFT_xADForestProperties.psm1, line 327 at r3 (raw file):
-f 'replacing with'
If we do it liek this, we can't localize the string 'replacing with'. You could add 'replacing with' as a separate localized string too, but that might be difficult to get grammatically correct in other languages. Maybe it is best to have separate strings even if they are mostly duplicate. 🤔
Throughout.
DSCResources/MSFT_xADForestProperties/MSFT_xADForestProperties.schema.mof, line 7 at r3 (raw file):
UserPrincipalNameSuffixToExclude
This property actually removes UPN already present in the forest? The word 'Exclude' is not intuitive then, I misinterpreted it as it would exclude one of those in the include property.
Maybe it's better to name this UserPrincipalNameSuffixToRemove
('..:Remove') if that what it actually does?
DSCResources/MSFT_xADForestProperties/MSFT_xADForestProperties.schema.mof, line 10 at r3 (raw file):
ServicePrincipalNameSuffixToExclude
Same as previous comment.
@regedit32 Awesome work on this! 😃 |
1b20160
to
c77acbb
Compare
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.
Thank you @johlju !
Reviewable status: 1 of 7 files reviewed, 5 unresolved discussions (waiting on @johlju and @regedit32)
DSCResources/MSFT_xADForestProperties/MSFT_xADForestProperties.psm1, line 107 at r3 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
[Array]$forest.UpnSuffixes
We should have a space between the type and the variable name. Throughout.
Done.
DSCResources/MSFT_xADForestProperties/MSFT_xADForestProperties.psm1, line 327 at r3 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
-f 'replacing with'
If we do it liek this, we can't localize the string 'replacing with'. You could add 'replacing with' as a separate localized string too, but that might be difficult to get grammatically correct in other languages. Maybe it is best to have separate strings even if they are mostly duplicate. 🤔
Throughout.
Ah of course. Separate strings would be better. Done.
DSCResources/MSFT_xADForestProperties/MSFT_xADForestProperties.schema.mof, line 7 at r3 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
UserPrincipalNameSuffixToExclude
This property actually removes UPN already present in the forest? The word 'Exclude' is not intuitive then, I misinterpreted it as it would exclude one of those in the include property.
Maybe it's better to name thisUserPrincipalNameSuffixToRemove
('..:Remove') if that what it actually does?
Agreed. Changed to UserPrincipalNameSuffixToRemove
DSCResources/MSFT_xADForestProperties/MSFT_xADForestProperties.schema.mof, line 10 at r3 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
ServicePrincipalNameSuffixToExclude
Same as previous comment.
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 6 of 6 files at r4.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @regedit32)
README.md, line 340 at r4 (raw file):
* **Credential**: (optional) "Specifies the user account credentials to use to perform this task. * **ForestName**: Specifies the target Active Directory forest for the change. * **ServicePrincipalNameSuffix**: (optional) Specifies one or more Service Principal Name (SPN) Suffix to add/remove.
Can we add to the description when this parameter is used, all members are replaced (and the same update to comment-based help and in schema.mof too)?
README.md, line 340 at r4 (raw file):
ServicePrincipalNameSuffix
I think we should mention that this parameter cannot be used at the same time as the other two. Otherwise users might try to use all three at the same time 🤔
Maybe that works though, I haven't checked the code, I just assume this parameter is mutually exclusive. with the other two.
README.md, line 342 at r4 (raw file):
Include
When we use Remove on the other once, using Include on this reads strange 🤔 Would it be possible to maybe change Include to Add, or similar? 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: all files reviewed, 3 unresolved discussions (waiting on @regedit32 and @johlju)
README.md, line 340 at r4 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
Can we add to the description when this parameter is used, all members are replaced (and the same update to comment-based help and in schema.mof too)?
Done.
README.md, line 340 at r4 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
ServicePrincipalNameSuffix
I think we should mention that this parameter cannot be used at the same time as the other two. Otherwise users might try to use all three at the same time 🤔
Maybe that works though, I haven't checked the code, I just assume this parameter is mutually exclusive. with the other two.
Done.
README.md, line 342 at r4 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
Include
When we use Remove on the other once, using Include on this reads strange 🤔 Would it be possible to maybe change Include to Add, or similar? What do you think?
Yeah, I should have saw that too. Changed to Add.
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 5 of 5 files at r5.
Reviewable status: complete! all files reviewed, all discussions resolved
@regedit32 Awesome work on this one as usual! Thank you! 😃 |
…ty#178) - Added xADForestProperties: New resource to manage User and Principal Name Suffixes for a Forest.
Created a new resource to handle managing UPN and SPN suffixes in a Forest similar to this manual process Add User Principal Name Suffixes. Opened issue #177 for this proposed resource.
This change is