-
Notifications
You must be signed in to change notification settings - Fork 134
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
xUser, xGroup: Add NewName property #715
Conversation
Codecov Report
@@ Coverage Diff @@
## main #715 +/- ##
===================================
- Coverage 72% 72% -1%
===================================
Files 30 30
Lines 4427 4455 +28
===================================
+ Hits 3213 3219 +6
- Misses 1214 1236 +22
|
I added SamAccountName to Get-TargetResource...but maybe that's not how it's supposed to work. Should only mandatory parameters be included in Get-TargetResource? How do I address the code coverage failure? |
6ecaf76
to
42d34cd
Compare
Get-TargetResource should only have those non-mandatory parameters that are needed to get it to return the current state. To raise code coverage unit tests need to be added to cover the new code paths. 🙂 See diff view here to see what is not covered: https://app.codecov.io/gh/dsccommunity/xPSDesiredStateConfiguration/compare/715/diff You only need to add unit tests for the code you add. |
Question, should the property be named |
I added @PlagueHO to review this, hopefully he hav time to get around to this. |
That is the name of the property on the .NET class that is used in the module.
I assume that GroupName is an SID for nano server (which doesn't work currently in my branch) because it uses Set-LocalGroup, but for the .NET class wrapped by Get-Group and Save-Group it can be any name which unambiguously identifies the group. (Lots of possibilities in AD, but even for local I think there are more than just SID and SamAccountName for local. I think full name works too? ) |
Ok, then I'm going to revert that change. I just thought I was supposed to add it at first.
I'm working on unit tests; I have to learn how to unit test first. Give me a day or two maybe? 😃 Thanks! |
Good news! Many of my assumptions were simply wrong, so I'm going to re-fiddle this out a bit. For one, SamAccountName is a property on the class and is populated and returned to the Get-Group function, and accepts the new value successfully! And ignores it. So. Yeah. Alsö, my memory that Full Name could be used to look up a user alsö appears to be just not true; so it's SID or bust. Anyway. I shall be re-redoing this PR momentarily. Thanks! |
42d34cd
to
dd1459b
Compare
Following what NetAdapterName does in NetworkingDsc, I've named the new property NewName. I'm still trying to work out integration testing for this |
1b946f7
to
eb8e3da
Compare
d19621c
to
0e4b978
Compare
Add NewName property to allow setting the name of the group; this requires that the GroupName property be specified with something other than the SamAccountName (e.g., the SID).
Add NewName property to allow setting the name of the user; this requires that the UserName property be specified with something other than the SamAccountName (e.g., the SID).
Add NewName property to allow setting the name of the user or group; this requires that the UserName or GroupName property be specified with something other than the SamAccountName (e.g., the SID).
I'll review this weekend. Have blocked out the weekend to catch up on DSC. |
0e4b978
to
9fcfe95
Compare
Don’t allow the NewName parameter to set SamAccountName when creating an entirely new gorup.
Don’t allow the NewName parameter to set SamAccountName when creating an entirely new user.
f1fe557
to
746d7ab
Compare
I'm closing this PR b/c these changes touch many more files than I understood at first and on another thread someone pointed out that it makes it very hard to review when multiple resources are changed in a single patch. I've opened new PRs for just-one-resource-at-a-time. Thanks! |
Pull Request (PR) description
Adds optional parameter SamAccountName to User and Group resources to allow setting this property separately. This requires that GroupName be specified using something other than the SamAccountName, e.g. SID.
This Pull Request (PR) fixes the following issues
Task list
file CHANGELOG.md. Entry should say what was changed and how that
affects users (if applicable), and reference the issue being resolved
(if applicable).
and comment-based help.
This change is