-
Notifications
You must be signed in to change notification settings - Fork 35
Description
Checklist
- I have verified this is the correct repository for opening this issue.
- I have verified no other issues exist related to my problem.
- I have verified this is not an issue for a specific package.
- I have verified this issue is not security related.
What You Are Seeing?
This is on WSL on Windows, an initial install worked as expected, now I did something (possibly upgrade powershell to v5?) which broke win_chocolatey and other chocolatey modules completely. Note that choco install vlc for example on windows still succeeds. I see the same error on, for example, win_chocolatey_facts.
ansible windows -vvv -i inventory -k -m win_chocolatey -a 'name=vlc state=present'
or
ansible-playbook -vvv -i inventory -k install.yml --tags "vlc"
Inventory just links to the same windows host running WinRM. The above command gives me:
ansible [core 2.15.1]
config file = None
configured module search path = ['/home/User/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /home/User/.local/lib/python3.10/site-packages/ansible
ansible collection location = /home/User/.ansible/collections:/usr/share/ansible/collections
executable location = /home/User/.local/bin/ansible
python version = 3.10.6 (main, May 29 2023, 11:10:38) [GCC 11.3.0] (/usr/bin/python3)
jinja version = 3.1.2
libyaml = True
No config file found; using defaults
SSH password:
host_list declined parsing /home/User/win/inventory as it did not pass its verify_file() method
script declined parsing /home/User/win/inventory as it did not pass its verify_file() method
auto declined parsing /home/User/win/inventory as it did not pass its verify_file() method
Parsed /home/User/win/inventory inventory source with ini plugin
Skipping callback 'default', as we already have a stdout callback.
Skipping callback 'minimal', as we already have a stdout callback.
Skipping callback 'oneline', as we already have a stdout callback.
redirecting (type: modules) ansible.builtin.win_chocolatey to chocolatey.chocolatey.win_chocolatey
redirecting (type: modules) ansible.builtin.win_chocolatey to chocolatey.chocolatey.win_chocolatey
Using module file /home/User/.ansible/collections/ansible_collections/chocolatey/chocolatey/plugins/modules/win_chocolatey.ps1
Pipelining is enabled.
<192.168.0.xx> ESTABLISH WINRM CONNECTION FOR USER: User on PORT 5986 TO 192.168.0.xx
EXEC (via pipeline wrapper)
The full traceback is:
Cannot process argument transformation on parameter 'ChocoCommand'. Cannot convert the "System.Object[]" value of type "System.Object[]" to type "System.Management.Automation.CommandInfo".
At line:131 char:17
+ $chocoCommand = Install-Chocolatey @installParams
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Install-Chocolatey], ParameterBindingArgumentTransformationException
+ FullyQualifiedErrorId : ParameterArgumentTransformationError,Install-Chocolatey
ScriptStackTrace:
at Install-Chocolatey, <No file>: line 1091
at <ScriptBlock>, <No file>: line 131
System.Management.Automation.ParameterBindingArgumentTransformationException: Cannot process argument transformation on parameter 'ChocoCommand'. Cannot convert the "System.Object[]" value of type "System.Object[]" to type "System.Management.Automation.CommandInfo". ---> System.Management.Automation.ArgumentTransformationMetadataException: Cannot convert the "System.Object[]" value of type "System.Object[]" to type "System.Management.Automation.CommandInfo". ---> System.Management.Automation.PSInvalidCastException: Cannot convert the "System.Object[]" value of type "System.Object[]" to type "System.Management.Automation.CommandInfo".
at System.Management.Automation.LanguagePrimitives.ThrowInvalidCastException(Object valueToConvert, Type resultType)
at System.Management.Automation.LanguagePrimitives.ConvertNoConversion(Object valueToConvert, Type resultType, Boolean recurse, PSObject originalValueToConvert, IFormatProvider formatProvider, TypeTable backupTable)
at System.Management.Automation.LanguagePrimitives.ConversionData`1.Invoke(Object valueToConvert, Type resultType, Boolean recurse, PSObject originalValueToConvert, IFormatProvider formatProvider, TypeTable backupTable)
at System.Management.Automation.LanguagePrimitives.ConvertTo(Object valueToConvert, Type resultType, Boolean recursion, IFormatProvider formatProvider, TypeTable backupTypeTable)
at System.Management.Automation.ArgumentTypeConverterAttribute.Transform(EngineIntrinsics engineIntrinsics, Object inputData, Boolean bindingParameters, Boolean bindingScriptCmdlet)
--- End of inner exception stack trace ---
at System.Management.Automation.ArgumentTypeConverterAttribute.Transform(EngineIntrinsics engineIntrinsics, Object inputData, Boolean bindingParameters, Boolean bindingScriptCmdlet)
at System.Management.Automation.ParameterBinderBase.BindParameter(CommandParameterInternal parameter, CompiledCommandParameter parameterMetadata, ParameterBindingFlags flags)
--- End of inner exception stack trace ---
at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0)
at System.Management.Automation.PSScriptCmdlet.RunClause(Action`1 clause, Object dollarUnderbar, Object inputToProcess)
at System.Management.Automation.PSScriptCmdlet.DoEndProcessing()
at System.Management.Automation.CommandProcessorBase.Complete()
windows10 | FAILED! => {
"changed": false,
"msg": "Unhandled exception while executing module: Cannot process argument transformation on parameter 'ChocoCommand'. Cannot convert the \"System.Object[]\" value of type \"System.Object[]\" to type \"System.Management.Automation.CommandInfo\"."
}
However, if I become_user system, it seems to fix the issue:
ansible windows -vvv -i inventory -k --become --become-method runas --become-user System -m win_chocolatey -a 'name=filezilla state=present'
outputs:
windows10 | CHANGED => {
"changed": true,
"invocation": {
"module_args": {
"allow_empty_checksums": false,
"allow_multiple": false,
"allow_prerelease": false,
"architecture":
...
...
"stdout": "Chocolatey v2.0.0\r\nInstalling the following packages:\r\nfilezilla\r\nBy installing, you accept licenses for the packages.\r\n\r\nfilezilla v3.64.0 [Approved]\r\nfilezilla package files install completed. Performing other installation steps.\r\nInstalling 64-bit filezilla...\r\nfilezilla has been installed.\r\n The install of filezilla was successful.\r\n Software installed as 'exe', install location is likely default.\r\n\r\nChocolatey installed 1/1 packages. \r\n See the log for details (C:\\ProgramData\\chocolatey\\logs\\chocolatey.log).\r\n",
"stdout_lines": [
"Chocolatey v2.0.0",
"Installing the following packages:",
"filezilla",
"By installing, you
Either the error message in the first case is highly misleading, or something else fixes the issue when becoming system.
What is Expected?
Expecting the packages to be successfully installed.
How Did You Get This To Happen?
- Installed WSL and Ubuntu on Windows
- Installed ansible using
python3 -m pip install ansible && python3 -m pip install --upgrade ansible - Ran the ansible playbook to install packages on the host
win_pingmodule works, butwin_chocolatey,win_chocolatey_factsetc. shows with the error above
System Details
- Operating System: Linux COMPUTERNAME 5.15.90.1-microsoft-standard-WSL2 Remove the apt upgrade #1 SMP Fri Jan 27 02:56:13 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
- Windows PowerShell version: 5.1.22621.1778 (CLRVersion: 4.0.30319.42000)
- Chocolatey CLI Version: 2.0.0
- Chocolatey Licensed Extension version:
- Chocolatey License type:
- Terminal/Emulator: WSL2
Installed Packages
Chocolatey v2.0.0
chocolatey 2.0.0
chocolatey-compatibility.extension 1.0.0
chocolatey-core.extension 1.4.0
filezilla 3.64.0
vlc 3.0.18
vlc.install 3.0.18
6 packages installed.Output Log
Not running Chocolately CLI directlyAdditional Context
I tried this for various packages, like notepadplusplus, vlc, filezilla, nirlauncher and same issue. Like I mentioned, I did something that broke a previously working win_chocolatey.
Running Ansible on WSL (Windows Subsystem for Linux) on Windows.
User@Computer:~/win$ ansible --version
ansible [core 2.15.1]
config file = None
configured module search path = ['/home/User/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /home/User/.local/lib/python3.10/site-packages/ansible
ansible collection location = /home/User/.ansible/collections:/usr/share/ansible/collections
executable location = /home/User/.local/bin/ansible
python version = 3.10.6 (main, May 29 2023, 11:10:38) [GCC 11.3.0] (/usr/bin/python3)
jinja version = 3.1.2
libyaml = True
User@Computer:~/win$ ansible-playbook --version
ansible-playbook [core 2.15.1]
config file = None
configured module search path = ['/home/User/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /home/User/.local/lib/python3.10/site-packages/ansible
ansible collection location = /home/User/.ansible/collections:/usr/share/ansible/collections
executable location = /home/User/.local/bin/ansible-playbook
python version = 3.10.6 (main, May 29 2023, 11:10:38) [GCC 11.3.0] (/usr/bin/python3)
jinja version = 3.1.2
libyaml = True