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

ADUser: Unable to enter Debug Mode #427

Closed
johlju opened this issue Jul 11, 2019 · 0 comments · Fixed by #460
Closed

ADUser: Unable to enter Debug Mode #427

johlju opened this issue Jul 11, 2019 · 0 comments · Fixed by #460
Labels
enhancement The issue is an enhancement request. good first issue The issue should be easier to fix and can be taken up by a beginner to learn to contribute on GitHub

Comments

@johlju
Copy link
Member

johlju commented Jul 11, 2019

Details of the scenario you tried and the problem that is occurring

There are issues with entering debug mode (using Enable-DSCDebug -BreakAll) when a default value for a parameter is derived from a function or another parameter.

This issue has been reported both in issue dsccommunity/SqlServerDsc#448 and in issue dsccommunity/ComputerManagementDsc#231.

These lines will probably cause an issue entering debug mode.

https://github.com/PowerShell/xActiveDirectory/blob/337164a0fb4a4cf658a1a94b04e3f5501a2a4666/DSCResources/MSFT_xADUser/MSFT_xADUser.psm1#L226

https://github.com/PowerShell/xActiveDirectory/blob/337164a0fb4a4cf658a1a94b04e3f5501a2a4666/DSCResources/MSFT_xADUser/MSFT_xADUser.psm1#L690

https://github.com/PowerShell/xActiveDirectory/blob/337164a0fb4a4cf658a1a94b04e3f5501a2a4666/DSCResources/MSFT_xADUser/MSFT_xADUser.psm1#L1123

Verbose logs showing the problem

Not available - this issue is proactive.

Suggested solution to the issue

Remove the default value from the parameter and instead add the following code to the start of each function needing to set this default value.

if (-not $PSBoundParameters.ContainsKey('CommonName'))
{
    $CommonName = $UserName
}

The DSC configuration that is used to reproduce the issue (as detailed as possible)

n/a

The operating system the target node is running

n/a

Version and build of PowerShell the target node is running

n/a

Version of the DSC module that was used ('dev' if using current dev branch)

Dev

@johlju johlju added enhancement The issue is an enhancement request. good first issue The issue should be easier to fix and can be taken up by a beginner to learn to contribute on GitHub help wanted The issue is up for grabs for anyone in the community. labels Jul 11, 2019
@johlju johlju changed the title xADUser: Unable to enter Debug Mode ADUser: Unable to enter Debug Mode Jul 28, 2019
@johlju johlju added in progress The issue is being actively worked on by someone. and removed help wanted The issue is up for grabs for anyone in the community. labels Aug 2, 2019
johlju added a commit to johlju/ActiveDirectoryDsc that referenced this issue Aug 2, 2019
- Update the logic for setting the default value for the parameter
  `CommonName`. This is due to an how LCM handles parameters when a
  default value is derived from another parameter (issue dsccommunity#427).
johlju added a commit that referenced this issue Aug 3, 2019
- Changes to ADUser 
  - Update the logic for setting the default value for the parameter
    `CommonName`. This is due to an how LCM handles parameters when a
    default value is derived from another parameter (issue #427).
@johlju johlju removed the in progress The issue is being actively worked on by someone. label Aug 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement The issue is an enhancement request. good first issue The issue should be easier to fix and can be taken up by a beginner to learn to contribute on GitHub
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant