-
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
xActiveDirectory: Cleanup code #326
Conversation
Codecov Report
@@ Coverage Diff @@
## dev #326 +/- ##
====================================
+ Coverage 91% 92% +<1%
====================================
Files 20 20
Lines 2383 2511 +128
Branches 10 10
====================================
+ Hits 2190 2312 +122
- Misses 183 189 +6
Partials 10 10 |
@PlagueHO When you have an hour left over, would you mind reviewing this? 😉 It should not be to much to review I think, Please comment on additional this that need to be done if you see them, either I fix them or I will submit issue for that so other contributors can help. I already submitted a bunch of issues. |
ce52ca7
to
4e505bc
Compare
On this now! |
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.
Wonderful job @johlju - this code is looking so much better. Just some minor bits. I know there is other stuff to be done, but definitely leave for another PR.
Reviewed 33 of 33 files at r1.
Reviewable status: all files reviewed, 17 unresolved discussions (waiting on @johlju)
CHANGELOG.md, line 59 at r1 (raw file):
- Changes to xADObjectPermissionEntry - Change the description of the property IdentityReference. - Fix failure when applied in the same configuration as xADDomain
Nitpick - end with full stop. And the next line.
DSCResources/MSFT_xADDomain/MSFT_xADDomain.psm1, line 121 at r1 (raw file):
if ($isDomainMember) { ## We're already a domain member, so take the credentials out of the equation
Should be a single #
DSCResources/MSFT_xADDomain/MSFT_xADDomain.psm1, line 132 at r1 (raw file):
} ## No need to check whether the node is actually a domain controller. If we don't throw an exception,
Should be comment block
DSCResources/MSFT_xADDomain/MSFT_xADDomain.psm1, line 175 at r1 (raw file):
else { ## Not sure what's gone on here!
Should be a single #
DSCResources/MSFT_xADDomain/MSFT_xADDomain.psm1, line 253 at r1 (raw file):
$isCompliant = $true ## The Get-Target resource returns .DomainName as the domain's FQDN. Therefore, we
Should be comment block.
DSCResources/MSFT_xADDomain/MSFT_xADDomain.psm1, line 362 at r1 (raw file):
# Debug can pause Install-ADDSForest/Install-ADDSDomain, so we remove it. [ref] $null = $PSBoundParameters.Remove('Debug') ## Not entirely necessary, but run Get-TargetResouece to ensure we raise any pre-flight errors.
Should be a single #
DSCResources/MSFT_xADDomain/MSFT_xADDomain.psm1, line 376 at r1 (raw file):
$installADDSParams['CreateDnsDelegation'] = $true } if ($PSBoundParameters.ContainsKey('DatabasePath'))
Should be blank lines around these if blocks.
DSCResources/MSFT_xADDomain/MSFT_xADDomain.psm1, line 413 at r1 (raw file):
Write-Verbose -Message ($script:localizedData.CreatingForest -f $DomainName) $installADDSParams['DomainName'] = $DomainName if ($PSBoundParameters.ContainsKey('DomainNetbiosName'))
Should be blank lines around these if blocks.
DSCResources/MSFT_xADDomain/MSFT_xADDomain.psm1, line 429 at r1 (raw file):
'Finished' | Out-File -FilePath (Get-TrackingFilename -DomainName $DomainName) -Force # Signal to the LCM to reboot the node to compensate for the one we
Should be comment block.
DSCResources/MSFT_xADDomainTrust/MSFT_xADDomainTrust.psm1, line 269 at r1 (raw file):
# Create the target object $trgDirectoryContext = New-Object System.DirectoryServices.ActiveDirectory.DirectoryContext($DomainOrForest, $TargetDomainName, $TargetDomainAdministratorCredential.UserName, $TargetDomainAdministratorCredential.GetNetworkCredential().Password)
This should be using named parameters
DSCResources/MSFT_xADDomainTrust/MSFT_xADDomainTrust.psm1, line 273 at r1 (raw file):
# Create the source object $srcDirectoryContext = New-Object System.DirectoryServices.ActiveDirectory.DirectoryContext($DomainOrForest, $SourceDomainName)
This should be using named parameters
DSCResources/MSFT_xADKDSKey/MSFT_xADKDSKey.psm1, line 510 at r1 (raw file):
[OutputType([System.String])] param (
param ()
is allowed here I think in our Styleguidelines: https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
DSCResources/MSFT_xADManagedServiceAccount/MSFT_xADManagedServiceAccount.psm1, line 252 at r1 (raw file):
$compareTargetResourceNonCompliant = Compare-TargetResourceState @PSBoundParameters | Where-Object { $_.Pass -eq $false }
Needs -FilterScript
- and through out in all Where-Object blocks.
DSCResources/MSFT_xADManagedServiceAccount/MSFT_xADManagedServiceAccount.psm1, line 415 at r1 (raw file):
if ($Ensure -eq 'Present') { $isEnsureNonCompliant = $false
Needs blank line after this one.
DSCResources/MSFT_xADObjectPermissionEntry/MSFT_xADObjectPermissionEntry.psm1, line 334 at r1 (raw file):
{ # Convert to array to a string for easy compare [String] $currentActiveDirectoryRights = ($currentState.ActiveDirectoryRights |
S/b [System.String] or [string]- and next line too.
DSCResources/MSFT_xADUser/MSFT_xADUser.psm1, line 1324 at r1 (raw file):
# Find the associated AD property $adProperty = $adPropertyMap | Where-Object { $_.Parameter -eq $parameter }
Should have -FilterScript
Tests/Unit/MSFT_xADGroup.Tests.ps1, line 104 at r1 (raw file):
It 'Calls "Assert-Module" to check AD module is installed' { Mock -CommandName Get-ADGroup { return $fakeADGroup; }
Remove ; at end of lines in this file.
af32e42
to
f9ccbb0
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.
Ready for review again! 😄
Reviewable status: 13 of 34 files reviewed, 17 unresolved discussions (waiting on @PlagueHO)
CHANGELOG.md, line 59 at r1 (raw file):
Previously, PlagueHO (Daniel Scott-Raynsford) wrote…
Nitpick - end with full stop. And the next line.
Done. Did a bunch.
DSCResources/MSFT_xADDomain/MSFT_xADDomain.psm1, line 121 at r1 (raw file):
Previously, PlagueHO (Daniel Scott-Raynsford) wrote…
Should be a single #
Done. Throughout the repo.
DSCResources/MSFT_xADDomain/MSFT_xADDomain.psm1, line 132 at r1 (raw file):
Previously, PlagueHO (Daniel Scott-Raynsford) wrote…
Should be comment block
Done. Throughout the repo.
DSCResources/MSFT_xADDomain/MSFT_xADDomain.psm1, line 175 at r1 (raw file):
Previously, PlagueHO (Daniel Scott-Raynsford) wrote…
Should be a single #
Done.
DSCResources/MSFT_xADDomain/MSFT_xADDomain.psm1, line 253 at r1 (raw file):
Previously, PlagueHO (Daniel Scott-Raynsford) wrote…
Should be comment block.
Done.
DSCResources/MSFT_xADDomain/MSFT_xADDomain.psm1, line 362 at r1 (raw file):
Previously, PlagueHO (Daniel Scott-Raynsford) wrote…
Should be a single #
Done.
DSCResources/MSFT_xADDomain/MSFT_xADDomain.psm1, line 376 at r1 (raw file):
Previously, PlagueHO (Daniel Scott-Raynsford) wrote…
Should be blank lines around these if blocks.
Done.
DSCResources/MSFT_xADDomain/MSFT_xADDomain.psm1, line 413 at r1 (raw file):
Previously, PlagueHO (Daniel Scott-Raynsford) wrote…
Should be blank lines around these if blocks.
Done.
DSCResources/MSFT_xADDomain/MSFT_xADDomain.psm1, line 429 at r1 (raw file):
Previously, PlagueHO (Daniel Scott-Raynsford) wrote…
Should be comment block.
Done.
DSCResources/MSFT_xADDomainTrust/MSFT_xADDomainTrust.psm1, line 269 at r1 (raw file):
Previously, PlagueHO (Daniel Scott-Raynsford) wrote…
This should be using named parameters
Done. Throughout the repo.
DSCResources/MSFT_xADDomainTrust/MSFT_xADDomainTrust.psm1, line 273 at r1 (raw file):
Previously, PlagueHO (Daniel Scott-Raynsford) wrote…
This should be using named parameters
Done.
DSCResources/MSFT_xADKDSKey/MSFT_xADKDSKey.psm1, line 510 at r1 (raw file):
Previously, PlagueHO (Daniel Scott-Raynsford) wrote…
param ()
is allowed here I think in our Styleguidelines: https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
Done. Missed that, thanks!
DSCResources/MSFT_xADManagedServiceAccount/MSFT_xADManagedServiceAccount.psm1, line 252 at r1 (raw file):
Previously, PlagueHO (Daniel Scott-Raynsford) wrote…
Needs
-FilterScript
- and through out in all Where-Object blocks.
Done. Throughout the repo.
DSCResources/MSFT_xADManagedServiceAccount/MSFT_xADManagedServiceAccount.psm1, line 415 at r1 (raw file):
Previously, PlagueHO (Daniel Scott-Raynsford) wrote…
Needs blank line after this one.
Done.
DSCResources/MSFT_xADObjectPermissionEntry/MSFT_xADObjectPermissionEntry.psm1, line 334 at r1 (raw file):
Previously, PlagueHO (Daniel Scott-Raynsford) wrote…
S/b [System.String] or [string]- and next line too.
Done. I submitted an issue to track this. I didn't fix this on purpose, I thought the PR was large enough. 😄
DSCResources/MSFT_xADUser/MSFT_xADUser.psm1, line 1324 at r1 (raw file):
Previously, PlagueHO (Daniel Scott-Raynsford) wrote…
Should have
-FilterScript
Done.
Tests/Unit/MSFT_xADGroup.Tests.ps1, line 104 at r1 (raw file):
Previously, PlagueHO (Daniel Scott-Raynsford) wrote…
Remove ; at end of lines in this file.
Done. Strange that I missed this file. :/
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.
Doh! Just two minor tweaks left. Great job though @johlju.
Reviewed 21 of 21 files at r2, 1 of 1 files at r3.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @johlju)
DSCResources/MSFT_xADDomain/MSFT_xADDomain.psm1, line 126 at r2 (raw file):
$forest = Get-ADForest -Identity $domain.Forest -ErrorAction Stop } else {
Doh! Missed this one - { needs to be on the next line.
DSCResources/MSFT_xADUser/MSFT_xADUser.psm1, line 152 at r2 (raw file):
} @{
I don't think this blank line should be here.
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.
Ready for review for a last time ( I hope) 😄
Reviewable status: 32 of 34 files reviewed, 2 unresolved discussions (waiting on @PlagueHO)
DSCResources/MSFT_xADDomain/MSFT_xADDomain.psm1, line 126 at r2 (raw file):
Previously, PlagueHO (Daniel Scott-Raynsford) wrote…
Doh! Missed this one - { needs to be on the next line.
Done. I missed that too when I went through all code :)
DSCResources/MSFT_xADUser/MSFT_xADUser.psm1, line 152 at r2 (raw file):
Previously, PlagueHO (Daniel Scott-Raynsford) wrote…
I don't think this blank line should be here.
Done. Ah, my bad :)
- Cleanup of code - It now set back the `$ErrorActionPreference` that was set prior to setting it to `'Stop'`.
- Cleanup of code.
- Cleanup of code.
- Cleanup of code.
- Minor style cleanup.
- Minor style cleanup.
- Code cleanup.
- Code cleanup.
- Code cleanup.
aabb55e
to
b638593
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: 30 of 34 files reviewed, all discussions resolved (waiting on @PlagueHO)
Thanks for the review @PlagueHO, much appreciated! I will merge this as soon as the tests pass. Added some entries to the change log that I saw that I missed when changing code during the review. No need to review that. |
Pull Request (PR) description
$ErrorActionPreference
that was set prior tosetting it to
'Stop'
.This Pull Request (PR) fixes the following issues
Task list
Entry should say what was changed, and how that affects users (if applicable).
and comment-based help.
This change is