-
Notifications
You must be signed in to change notification settings - Fork 141
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
xADObjectEnabledState: New resource #277
Conversation
Codecov Report
@@ Coverage Diff @@
## dev #277 +/- ##
====================================
+ Coverage 91% 91% +<1%
====================================
Files 19 20 +1
Lines 2317 2383 +66
Branches 10 10
====================================
+ Hits 2124 2190 +66
Misses 183 183
Partials 10 10 |
380050e
to
3f496ec
Compare
@nyanhp, @devopsjesus or @rchristman89 could anyone of you review this PR when you have time? It's a larger PR (new resource). |
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: 0 of 11 files reviewed, 1 unresolved discussion
DSCResources/MSFT_xADObjectEnabledState/MSFT_xADObjectEnabledState.psm1, line 368 at r1 (raw file):
function Set-DscADComputer
This helper function exist both in xADComputer and here, it should be moved out to a common helper function.
8d22b45
to
8229604
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.
Reviewable status: 0 of 14 files reviewed, all discussions resolved
DSCResources/MSFT_xADObjectEnabledState/MSFT_xADObjectEnabledState.psm1, line 368 at r1 (raw file):
Previously, johlju (Johan Ljunggren) wrote…
function Set-DscADComputer
This helper function exist both in xADComputer and here, it should be moved out to a common helper function.
Done
@PlagueHO World you mind review this one when you have a chance. We need to have this merged before next release (~month away) 😊 |
8229604
to
d16a1c3
Compare
@PlagueHO know your busy. Just pinging for a reminder. 🙂 |
d16a1c3
to
df8a0e6
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.
Reviewed 1 of 6 files at r2.
Reviewable status: 0 of 11 files reviewed, 3 unresolved discussions (waiting on @devopsjesus and @johlju)
README.md, line 51 at r2 (raw file):
#xadobjectenabledstate
is this supposed to be here still? I've not seen this schema used before.
DSCResources/MSFT_xADObjectEnabledState/MSFT_xADObjectEnabledState.psm1, line 90 at r2 (raw file):
'Computer'
Is the idea to add ValidationSets and switch cases here with the addition of objects that are supported?
DSCResources/MSFT_xADObjectEnabledState/MSFT_xADObjectEnabledState.psm1, line 319 at r2 (raw file):
Quoted 25 lines of code…
$getTargetResourceParameters = @{ Identity = $Identity ObjectClass = $ObjectClass Enabled = $Enabled DomainController = $DomainController Credential = $Credential } # Need the @() around this to get a new array to enumerate. @($getTargetResourceParameters.Keys) | ForEach-Object { if (-not $PSBoundParameters.ContainsKey($_)) { $getTargetResourceParameters.Remove($_) } } $getTargetResourceResult = Get-TargetResource @getTargetResourceParameters $compareTargetResourceStateParameters = @{ CurrentValues = $getTargetResourceResult DesiredValues = $PSBoundParameters Properties = @('Enabled') } $compareTargetResourceStateResult = Compare-ResourcePropertyState @compareTargetResourceStateParameters
This code block is repeated throughout each function (get/set/test), so could you put it in a helper function to reduce repeated code?
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.
Will fix the new helper function tomorrow.
Reviewable status: 0 of 11 files reviewed, 3 unresolved discussions (waiting on @devopsjesus and @johlju)
README.md, line 51 at r2 (raw file):
Previously, devopsjesus (Jason Ryberg) wrote…
#xadobjectenabledstate
is this supposed to be here still? I've not seen this schema used before.
I think this was fixed in the rebase?
DSCResources/MSFT_xADObjectEnabledState/MSFT_xADObjectEnabledState.psm1, line 90 at r2 (raw file):
Previously, devopsjesus (Jason Ryberg) wrote…
'Computer'
Is the idea to add ValidationSets and switch cases here with the addition of objects that are supported?
Yes, that was my thought.
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.
I fixed the review comment today. Thanks for the review @devopsjesus! Ready for review again.
Reviewable status: 0 of 11 files reviewed, 3 unresolved discussions (waiting on @devopsjesus)
DSCResources/MSFT_xADObjectEnabledState/MSFT_xADObjectEnabledState.psm1, line 319 at r2 (raw file):
Previously, devopsjesus (Jason Ryberg) wrote…
$getTargetResourceParameters = @{ Identity = $Identity ObjectClass = $ObjectClass Enabled = $Enabled DomainController = $DomainController Credential = $Credential } # Need the @() around this to get a new array to enumerate. @($getTargetResourceParameters.Keys) | ForEach-Object { if (-not $PSBoundParameters.ContainsKey($_)) { $getTargetResourceParameters.Remove($_) } } $getTargetResourceResult = Get-TargetResource @getTargetResourceParameters $compareTargetResourceStateParameters = @{ CurrentValues = $getTargetResourceResult DesiredValues = $PSBoundParameters Properties = @('Enabled') } $compareTargetResourceStateResult = Compare-ResourcePropertyState @compareTargetResourceStateParameters
This code block is repeated throughout each function (get/set/test), so could you put it in a helper function to reduce repeated code?
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.
Reviewable status: 0 of 11 files reviewed, 2 unresolved discussions (waiting on @devopsjesus and @johlju)
Tests/Integration/MSFT_xADObjectEnableState.Integration.Tests.ps1, line 2 at r3 (raw file):
[Microsoft.DscResourceKit.IntegrationTest(OrderNumber = 3)]
There seem to only be two integration tests - am I missing a test, or should OrderNumber = 3
be changed to OrderNumber = 2
? Also, it was hard to get this to run with this script attribute, since the module it is downloading has the attribute definition. Should we load the module for the attribute to be available in a initialization script first so the attribute will also load, or am I missing something?
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: 0 of 12 files reviewed, 2 unresolved discussions (waiting on @devopsjesus)
Tests/Integration/MSFT_xADObjectEnableState.Integration.Tests.ps1, line 2 at r3 (raw file):
Done. I have removed this attribute from both tests for now.
Neither were not starting at OrderNumber = 1
since that integration tests should be the one setting up the domain, which does not yet exist. Read more here about the attribute. https://github.com/PowerShell/DscResource.Tests#run-integration-tests-in-order
Also, it was hard to get this to run with this script attribute, since the module it is downloading has the attribute definition. Should we load the module for the attribute to be available in a initialization script first so the attribute will also load, or am I missing something?
I working on getting this working to have a guide on how to run the integration tests. WIP: https://github.com/johlju/xActiveDirectory/tree/add-integ-documentation/Tests
Uses Assert-TestEnvironment.ps1
to load the necessary types
Not sure it is possible to have a Pester integration tests that sets up the domain because of the necessary restart. I have the config ready, must test out the best way to set up domain controllers and verify the result. Once the domain controllers are up it is a small thing running the other integration tests. Thats when the order number comes in. For example the integration tests that set's up a user can later be used by the group integration tests to add that user. THis is to simplify the tests so each test doesn't have to set up a lot of prerequisites.
See for example in SqlServerDsc where we use dependent tests: https://github.com/PowerShell/SqlServerDsc/blob/dev/Tests/Integration/README.md
@devopsjesus this one is ready for review again. |
7dc6099
to
3324b49
Compare
@devopsjesus do you have time to look through this again, would love to fix any more potential issues so we can get this merged. 🙂 |
I will try to get to this in the next few days :)
…On Tue, Jun 11, 2019 at 11:47 AM Johan Ljunggren ***@***.***> wrote:
@devopsjesus <https://github.com/devopsjesus> do you have time to look
through this again, would love to fix any more potential issues so we can
get this merged. 🙂
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#277>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AH25XGS6MQYV2RMZ2KREBSDPZ7XL5ANCNFSM4HNXKKWA>
.
|
Thank you! 🙇 |
3324b49
to
6a72208
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.
Reviewed 4 of 11 files at r1, 4 of 10 files at r3, 6 of 8 files at r4.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @johlju)
Tests/Integration/MSFT_xADObjectEnableState.Integration.Tests.ps1, line 2 at r3 (raw file):
I was able to get these tests to run on an already promoted DC.
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: complete! all files reviewed, all discussions resolved
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: complete! all files reviewed, all discussions resolved
@devopsjesus thank you so much for the review! 😃 I will merge this as soon as I have merged in another PR. |
Pull Request (PR) description
used to enforce the
Enabled
property of computer accounts. Thisresource replaces the deprecated
Enabled
property in the resourcexADComputer.
The verbose output of the integration tests are in this gist:
https://gist.github.com/johlju/fdb402beb503529d9265f934e4ec6781
This Pull Request (PR) fixes the following issues
From the result of the discussion in PR #170 and fixes one part of the outcome in option #1 in the #170 (comment).
Task list
Entry should say what was changed, and how that affects users (if applicable).
and comment-based help.
This change is