You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using module file .ansible/collections/ansible_collections/community/windows/plugins/modules/win_domain_user.ps1
At line:213 char:9
+ Add-Warning -obj $result -message "Failed to enumerate user g ...
+ ~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Add-Warning:String) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : CommandNotFoundException
ScriptStackTrace:
at Get-PrincipalGroup, <No file>: line 213
at <ScriptBlock>, <No file>: line 551
What seems to be happening is that the user info is succesfully obtained, but it fails for some reason to obtain the group information (I did the same steps interactivelly and there was no issue), when it ends up running the catch block it can't parse "Add-Warning".
I couldn't find any Add-Warning in the powershell documentation. There is Write-Warning , but it doesn't have an -obj parameter.
I've tried replacing it with Write-Warning, however this warning does not appear to be displayed anywhere in Ansible, the function simply returns null.
# if using a version older than ansible-core 2.12 you should omit the '-t all'
$ ansible-config dump --only-changed -t allHOST_KEY_CHECKING(/var/lib/myframework/.ansible.cfg) = False
OS / Environment
CentOS Linux release 8.4.2105
This is on the Powershell version on the target Windows server:
TASK [] *********************************************task path: my/main.yml:2Using module file .ansible/collections/ansible_collections/community/windows/plugins/modules/win_domain_user.ps1Pipelining is enabled.EXEC (via pipeline wrapper)The full traceback is:The term 'Add-Warning' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.At line:213 char:9+ Add-Warning -obj $result -message "Failed to enumerate user g ...+ ~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (Add-Warning:String) [], ParentContainsErrorRecordException + FullyQualifiedErrorId : CommandNotFoundExceptionScriptStackTrace:at Get-PrincipalGroup, <No file>: line 213at <ScriptBlock>, <No file>: line 551fatal: [my_server]: FAILED! => { "changed": false, "msg": "Unhandled exception while executing module: The term 'Add-Warning' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again."}
### Code of Conduct
- [X] I agree to follow the Ansible Code of Conduct
The text was updated successfully, but these errors were encountered:
The Add-Warning cmdlet is provided by the legacy module wrapper used in older Ansible modules. This module has recently been updated to use the newer wrapper but unfortunately this particular part was missed in the conversion. The PR #416 fixes up this issue so that the warning is properly displayed back to the user to help debug why it's failing to get the group membership.
Summary
What seems to be happening is that the user info is succesfully obtained, but it fails for some reason to obtain the group information (I did the same steps interactivelly and there was no issue), when it ends up running the catch block it can't parse "Add-Warning".
I couldn't find any
Add-Warning
in the powershell documentation. There is Write-Warning , but it doesn't have an -obj parameter.I've tried replacing it with Write-Warning, however this warning does not appear to be displayed anywhere in Ansible, the function simply returns null.
Issue Type
Bug Report
Component Name
lib/ansible/modules/windows/win_domain_user.ps1
Ansible Version
Configuration
OS / Environment
CentOS Linux release 8.4.2105
This is on the Powershell version on the target Windows server:
Steps to Reproduce
Expected Results
User information.
Actual Results
The text was updated successfully, but these errors were encountered: