Skip to content

Commit

Permalink
streamline AD user attribute setting (ansible-collections#248)
Browse files Browse the repository at this point in the history
This change set ensures that running in change mode does return the user
object as well. Otherwise, Ansible reports the user as being absent. Which is
pretty confusing for the caller.
  • Loading branch information
conitrade-as authored May 15, 2021
1 parent ca03e76 commit a086021
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions plugins/modules/win_domain_user.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -280,12 +280,9 @@ If ($state -eq 'present') {
}

if ($run_change) {
try {
$user_obj = $user_obj | Set-ADUser -WhatIf:$check_mode -PassThru @set_args
} catch {
Fail-Json $result "failed to change user $($name): $($_.Exception.Message)"
}
Set-ADUser -Identity $user_guid -WhatIf:$check_mode @set_args
$result.changed = $true
$user_obj = Get-ADUser -Identity $user_guid -Properties * @extra_args
}


Expand Down

0 comments on commit a086021

Please sign in to comment.