-
Notifications
You must be signed in to change notification settings - Fork 909
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
Removal of "localonly" parameter in v2.0 has broken many machine setup scripts #3177
Comments
By the way, your documentation here still mentions "localonly", like this:
What is the alternative to "--localonly" now? How do we list programs which are installed on the system? |
Here is another code example which fails due to this change to the "localonly" parameter:
|
Please see the upgrade guide for information around the changes to the choco list command.
I would suggest you use |
I have found another command which broke due to this same set of changes, this also causes problems in automation scripts. These scripts look for a package in a private source repository of artifacts:
|
As indicated by the upgrade guide the list command only lists locally installed packages. The command |
Here is something interesting that this change has caused. Originally I had a script that updated itself as a chocolatey package. It used "choco list MyPackage" to find which version of that package was on the server. Then it tried to update itself if a new version was on the server. Now "choco list MyPackage" only lists the local package, so it always thinks it has the same version, and it never upgrades itself. The only way to get it to change on the various machines (which run the script at bootup) is for the scripts to think a new version is available. It has just now become a chicken-and-egg problem where the scripts can't ever get the new version (with the chocolatey parameter corrections) because they can never see whether there is a new version available. This is a seriously bad change to the command line parameters. The differences between local and remote package queries just flipped on us, and now the scripts are all chicken-and-egged. |
Change that to This has been deprecated since version 1.0 (released on March 21 2022) alongside other items. Every time that And this message would be added to the logs Being direct, what more would you want us to do? We have deprecated it over a year ago and added a message to the screen and the logs every time the It is not good practice to upgrade any software to the latest version automatically. Particularly major versions. Breaking changes are going to hit you at some point. You should only use known working versions of software and when new versions are released, test them and upgrade to them in a managed way. If you do not do that, you will have a bad time at some point. The solution to your issue is to downgrade to version 1.4.0 and not to upgrade to the latest version. This will resolve your issue now, and then when you have made changes and are ready to upgrade to a major release, you can do so in a managed way. I have raised two PR's to amend the help text that you identified and update the documentation for the |
Regarding those deprecation messages: We don't see them when chocolatey is run inside a script. The scripts blithely cruise along and do their job until one day they break catastrophically. Regarding what you could do: Since this is already a done deal, there's nothing you can do, it seems. However, in the future, consider the karmic ramifications before introducing breaking changes to command line parameters. By that I mean: Because of the amount of manual labor this is causing me, I'm seriously considering quitting my job today. Alternatively, I suppose, you could have done same thing that they did when they broke Nunit's command line parameters in version 3.0, and actually change the product name and the executable name from "nunit" to "nunit3" so that the old version still worked for everyone. That was a much smoother transition. |
@tfabris I'm not sure I have anything to add beyond what I've said above. I will answer your questions in the last comment.
The messages are also added to the logs. If you don't read those, then I don't think we could have got that information to whatever we would have done.
As I mentioned above, we did that and added deprecations in March 2022 and removed them, in a major release. That's when we can break things, only in a major release. My advice remains the same in this area, don't automatically upgrade to the latest version for any software.
I'm sorry that you're having a bad time. As somebody who has worked in IT for 32 years now, primarily in an Operations / Infrastructure role, I understand the stress of everything going wrong at the one time. You do have my genuine sympathy.
This would result in everybody who wanted to use the new Chocolatey CLI 2.0.0 release having to update their scripts to use the new My suggestion for you remains downgrading to 1.4.0 and pinning to that version until you have the opportunity to amend your scripts. I agree that's not ideal, but it is the only option I can see that would help just now. I am going to go ahead and close this issue now, as I don't feel there is anything more for us to do. If I'm wrong, please let me know and we can always reopen it again. |
@pauby - Thanks so much for responding in detail. Indeed, we're pinning at 1.4.0 for now. |
Checklist
What You Are Seeing?
Chocolatey v2.0 removed the parameter "list --localonly" which is the way that many of my machine setups scripts detected whether a certain package was installed or not.
This removal has caused race conditions in my machine setups, starting today. I am including example code in the "how did you get this to happen" section.
What is Expected?
Expected: The "--localonly" command should still work, preventing race conditions in existing setup scripts.
How Did You Get This To Happen?
Example powershell code:
The code above puts the machine into an infinite reboot loop, when it used to work fine before the 2.0 version of Chocolatey.
System Details
Installed Packages
Output Log
choco list --localonly Chocolatey v2.0.0 Invalid argument --localonly. This argument has been removed from the list command and cannot be used.
Additional Context
No response
The text was updated successfully, but these errors were encountered: