dsccommunity / dsccommunity/ActiveDirectoryDsc

ADDomainController: Test method does not check all values

Open
#146 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug help wanted
Dominant language
PowerShell
Stars
388
Forks
141
PR merge metrics
No merged PRs in 30d

Description

Test-TargetResource has some issues.

  • It does not look for properties SysvolPath, LogPath and DatabasePath
  • It throws an exception if the site name is wrong instead of returning a bool
  1. Provided a non-existing path still returns true
Test-TargetResource -DomainName contoso.com -DomainAdministratorCredential $cred -SafemodeAdministratorPassword $cred -DatabasePath C:\WrongPath -SiteName Default-First-Site-Name
True
  1. Providing a non-existing site throws an exception and does not return a bool
Test-TargetResource -DomainName contoso.com -DomainAdministratorCredential $cred -SafemodeAdministratorPassword $cred -DatabasePath C:\WrongPath -SiteName WrongSite
Site 'WrongSite' could not be found.
At line:196 char:13
+             throw (New-Object -TypeName System.InvalidOperationExcept ...
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (:) [], InvalidOperationException
    + FullyQualifiedErrorId : Site 'WrongSite' could not be found.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the AD domain controller resource's Test-TargetResource method and reproduce the two PowerShell examples from the issue. Trace how SysvolPath, LogPath, DatabasePath, and SiteName are evaluated. Done means the method checks all three paths and returns a Boolean for a missing site instead of throwing an exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
devops
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.