-
Notifications
You must be signed in to change notification settings - Fork 29
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_chocolatey task crashes if PATH contains multiple choco.exe on the target machine #147
Comments
This feels like trying to fix the symptom, rather than the problem. Chocolatey CLI installation path should not be on the PATH twice and in all my time working with it, I've never seen it on there, multiple times. Has there been troubleshooting on why it's ending up on the PATH twice? |
Hi, it is in the PATH twice because there are two separate installations that govern two sets of installed programs. It is not my idea, but the person responsible told me that there are reasons. Nevertheless, I think ansible should not crash, and therefore the capability of Get-Command to return a list should be accounted for. I think that behaving the same way as typing the choco.exe command in a Powershell is also what the user expects. This motivated me to propose this fix. |
Is that two separate installations of Chocolatey CLI? If that is the case that is not supported.
I'd be interested to know what those reasons are as I cannot imagine any situation where you would need two separate installations of Chocolatey CLI. If my understanding above is correct, the environment you are running in is going to lead to problems of all sorts and is not supported. I'm interested to understand the reasons for having multiple installation to see if we can get you to a know good supported state. |
Well, I see two points here:
All in all, I think improving the stability of win_chocolatey is only beneficial. |
I think you misunderstand or I've not been clear. I am not suggesting we don't implement the fix. I'm suggesting that the problem you have put your environment into is:
The playbook is not designed to support multiple Chocolatey CLI installations, so that is why you are seeing the issue. It is not desirable, but it is expected behaviour. Thank you for the PR. To set expectations, we don't have any plans to release a new version of the collection in the near future. But it is something we will get released. |
@pauby Thanks a lot! I am glad this will be released. |
Checklist
What You Are Seeing?
When I try to use win_chocolatey to install any package on a target machine that has two chocolatey installations in the path, I get a powershell syntax error:
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"
This means that a CommandInfo is expected but a List is received.
What is Expected?
win_chocolatey should not crash
How Did You Get This To Happen?
I ran ansible with a playbook containing win_chocolatey
System Details
Installed Packages
Output Log
Additional Context
I have a fix
The text was updated successfully, but these errors were encountered: