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

xADOrganizationalUnit: Catch Exception When the Path Property specifies a Non-Existing Path #413

Merged
merged 5 commits into from
Jul 5, 2019
Merged

xADOrganizationalUnit: Catch Exception When the Path Property specifies a Non-Existing Path #413

merged 5 commits into from
Jul 5, 2019

Conversation

X-Guardian
Copy link
Contributor

@X-Guardian X-Guardian commented Jul 3, 2019

Pull Request (PR) description

This PR adds code to the xADOrganizationalUnit resource to catch the ADIdentityNotFoundException returned by Get-ADOrganizationalUnit and return an improved error message.

This Pull Request (PR) fixes the following issues

Task list

  • Added an entry under the Unreleased section in the CHANGELOG.md.
    Entry should say what was changed, and how that affects users (if applicable).
  • Resource documentation added/updated in resource directory README.md.
  • Resource parameter descriptions added/updated in 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 Resource Testing Guidelines.
  • Integration tests added/updated (where possible). See DSC Resource Testing Guidelines.
  • New/changed code adheres to DSC Resource Style Guidelines and Best Practices.

This change is Reviewable

@codecov-io
Copy link

codecov-io commented Jul 3, 2019

Codecov Report

Merging #413 into dev will increase coverage by <1%.
The diff coverage is 80%.

Impacted file tree graph

@@         Coverage Diff          @@
##            dev   #413    +/-   ##
====================================
+ Coverage    92%    92%   +<1%     
====================================
  Files        20     20            
  Lines      2538   2541     +3     
  Branches     10     10            
====================================
+ Hits       2345   2348     +3     
  Misses      183    183            
  Partials     10     10

@johlju johlju added the waiting for author response The pull request is waiting for the author to respond to comments in the pull request. label Jul 3, 2019
@X-Guardian X-Guardian marked this pull request as ready for review July 3, 2019 20:27
Copy link
Member

@PlagueHO PlagueHO 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 2 files at r1, 3 of 3 files at r3.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @X-Guardian)


DSCResources/MSFT_xADOrganizationalUnit/MSFT_xADOrganizationalUnit.psm1, line 30 at r3 (raw file):

    try
    {
        $ou = Get-ADOrganizationalUnit -Filter { Name -eq $Name } -SearchBase $Path -SearchScope OneLevel -Properties ProtectedFromAccidentalDeletion, Description

Might be worth splitting this line with a backtick so that it gets in below 120 chars. Alternatively, could splat this.

@johlju johlju 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 Jul 5, 2019
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 2 files at r1, 2 of 3 files at r3.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @PlagueHO)


DSCResources/MSFT_xADOrganizationalUnit/MSFT_xADOrganizationalUnit.psm1, line 30 at r3 (raw file):

Previously, PlagueHO (Daniel Scott-Raynsford) wrote…

Might be worth splitting this line with a backtick so that it gets in below 120 chars. Alternatively, could splat this.

Yeah, spatting this would make it easier to read, especially when revewing. But won't hold the PR up because of it since it is old code. There are more places this need to be resolved. I will add an issue for this. The local variable could also be more descriptive, also another PR. 🙂

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:

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @PlagueHO)

@johlju johlju merged commit 46c6cf2 into dsccommunity:dev Jul 5, 2019
@johlju johlju removed the needs review The pull request needs a code review. label Jul 5, 2019
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.

xADOrganizationalUnit: Unhandled Exception when the Path Property specifies a Non-Existing Path
4 participants