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

win_group_membership - fix random issue with CI on 2012 R2 #45462

Merged
merged 1 commit into from
Sep 11, 2018

Conversation

jborean93
Copy link
Contributor

SUMMARY

As part of #45334, I found that win_group_membership occasionally fails to cast the ADSI object object when getting the group membership with

Cannot convert value "System.__ComObject" to type "System.DirectoryServices.DirectoryEntry". Error: "COM object that has been separated from its underlying RCW cannot be used."
At line:51 char:58
+     $current_members = $Group.psbase.Invoke("Members") | ForEach-Object {
+                                                          ~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [ForEach-Object], RuntimeException
    + FullyQualifiedErrorId : InvalidCastConstructorException,Microsoft.PowerShell.Commands.ForEachObjectCommand
ScriptStackTrace:
at <ScriptBlock>, <No file>: line 54
at Get-GroupMember, <No file>: line 51
at <ScriptBlock>, <No file>: line 106

Changing the method to cast it just once before running the InvokeGet methods fixed this issue in that branch. Creating a separate PR so I can backport the changes without relying on a feature PR.

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

win_group_membership

ANSIBLE VERSION
devel

@ansibot
Copy link
Contributor

ansibot commented Sep 11, 2018

@ansibot ansibot added affects_2.8 This issue/PR affects Ansible v2.8 bug This issue/PR relates to a bug. core_review In order to be merged, this PR must follow the core review workflow. module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. support:community This issue/PR relates to code supported by the Ansible community. support:core This issue/PR relates to code supported by the Ansible Engineering Team. windows Windows community and removed support:community This issue/PR relates to code supported by the Ansible community. labels Sep 11, 2018
@jborean93 jborean93 merged commit 3371a77 into ansible:devel Sep 11, 2018
@jborean93 jborean93 deleted the win_group_membership-bug branch September 11, 2018 03:07
jborean93 added a commit to jborean93/ansible that referenced this pull request Sep 11, 2018
jborean93 added a commit to jborean93/ansible that referenced this pull request Sep 11, 2018
@jborean93
Copy link
Contributor Author

Backport PRs
stable-2.6 #45470
stable-2.7 #45471

@webknjaz webknjaz removed needs_triage Needs a first human triage before being processed. labels Sep 11, 2018
abadger pushed a commit that referenced this pull request Sep 11, 2018
mattclay pushed a commit that referenced this pull request Sep 25, 2018
@ansible ansible locked and limited conversation to collaborators Jul 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.8 This issue/PR affects Ansible v2.8 bug This issue/PR relates to a bug. core_review In order to be merged, this PR must follow the core review workflow. module This issue/PR relates to a module. support:core This issue/PR relates to code supported by the Ansible Engineering Team. windows Windows community
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants