-
Notifications
You must be signed in to change notification settings - Fork 23.7k
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
Update win_domain_group_membership.ps1 #56953
Conversation
Bug fixes while Adding and Deleting a group from another group
Bug fixes while Adding and Deleting a group from another group
cc @dagwieers @if-meaton @jborean93 @jhawkesworth @nitzmahone |
Bug fixes while Adding and Deleting a group from another group
Bug fixes while Adding and Deleting a group from another group
Please add a changelog fragment to document the bug fix. |
I have added the changelog fragment 57104 @ShachafGoldstein |
Hi @ShachafGoldstein |
try { | ||
Add-ADGroupMember -Identity $name -Members $group_member -WhatIf:$check_mode @extra_args | ||
} catch { | ||
Fail-Json $result "Failed to add a group $($group_member): $($_.Exception.Message)" |
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.
A silly comment but probably should be Failed to add group $($group_member): $($_.Exception.Message)
or Failed to add a group: $($group_member) - $($_.Exception.Message)
try { | ||
Remove-ADGroupMember -Identity $name -Members $group_member -WhatIf:$check_mode @extra_args -Confirm:$False | ||
} catch { | ||
Fail-Json $result "Failed to remove a group $($group_member): $($_.Exception.Message)" |
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.
Same as the add comment
try { | ||
Remove-ADGroupMember -Identity $name -Members $current_member -WhatIf:$check_mode @extra_args -Confirm:$False | ||
} catch { | ||
Fail-Json $result "Failed to remove a group $($group_member): $($_.Exception.Message)" |
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.
Here as well, regarding the grammar/text
I can't really merge anything but if it is urgent for you, you can add it to the weekly meeting agenda and join the IRC to move it faster. |
Personally I don’t see the point to this PR. A try/catch is only fired in the event of a terminating error which means the script would have stopped. Since 2.8 we should be giving better error message that will result in a lot better error output which removes the necessity of the Fail-Json for individual commands. We should only be using Fail-Json if we are manually throwing a failure or the error message doesn’t make sense in the context where it happens. |
@ShachafGoldstein @jborean93 |
@AravindBalajiS Your branch does not contain a shippable.yml file. Please rebase your branch to trigger running of current tests. |
Given #56953 (comment) I think this can be closed. |
Bug fixes while Adding and Deleting a group from another group
SUMMARY
I was trying to add DEF group to ABC group after executing the ansible script I checked the members that are present in ABC groups, the DEF group was not added to it. As DEF group was not present in ABC group after executing the ansible script then I tried to add DEF group to ABC group using the ps1 script, after execution of the ps1 script I found that DEF is a universal group and ABC is a global group, as a global group cannot have a universal group as a member. So the ps1 script failed while executing. But while executing the ansible script it got passed, it didn't show any error while execting it.
ISSUE TYPE
COMPONENT NAME
win_domain_group_membership
ADDITIONAL INFORMATION
STEPS TO REPRODUCE
This can be reproduced by running the following playbook
EXPECTED RESULTS
ACTUAL RESULTS