-
Notifications
You must be signed in to change notification settings - Fork 905
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
Mark packages pending until install/upgrade completes successfully - transactional operations #198
Comments
I could almost swear you or someone already created an issue with this? |
But I don't see one, so perhaps it was on chocolatey/chocolatey then prior to chocolatey-archive/chocolatey#698 |
Found it chocolatey-archive/chocolatey#608 (related but not the same) |
I don't think these are the same - I have that CTRL-C behavior as well. So after CTRL-C the powershell prompt where that occured asks if you would like to abort the current batch file y/n - it's exactly the prompt you get when breaking out of a .CMD or .BAT - but it won't go away - it pops up everytime you try another command in that console prompt - you have to close the prompt. This request is broader => no matter how a package dies (in my case while I'm developing a chocolatey package and my code isn't solid yet and I get a PowerShell error), then the next attempt to install the package say it is already installed and requires either a -Force or a deinstall and reinstall. It seems like Chocolately should only mark a package as complete if it actually completed successfully. Maybe it's already supposed to work that way but does not work properly when an actual powershell error occurs? I was assuming it uses the presence of the package folder as an "already installed" marker - which would explain this behavior - but definitely and assumption. |
Are you using 0.9.9+? This is mostly a curiosity. It should be erroring on posh errors where the older versions may have missed those errors. |
you are not wrong @ferventcoder - #188 I mentioned it 2 days ago... |
I think it is not quite an enhancement but a bug. It requires to remember what package is being processed while hitting Ctrl+C to force update it later. Otherwise it leaves an old package installed and you never know when the new version would be available. |
@mlt If you do control+c, choco throws a huge warning at you not to do that. It should probably clean up though. Which is sort of what this is about. |
Not sure if this is covered, but just so it's clear I get this behaviour even if I Ctrl + C at the 'Do you want to run the script?' stage: C:\Users\admin>choco install orbis-tmserver orbis-tmserver v3.50.0.12
C:\Users\admin>choco list -l At this point no install steps have been done, so it was a surprise to find this :). |
Whoops - timbrown5 posted while I was doing the below. Rob - is this a happenstance that it works now? If not, could you explain the changes that address this? ************** Previous Post ********************** Personally I think the "installed" marker in Choco should be enhanced to use the presence of a file or registry key. Perhaps a required attribute "existence" resource should be specified in the script or a custom NUSPEC attribute. Maybe that resource can have an optional version check. (uninstall keys and EXEs and DLLs have these) Perhaps the "uninstall" reg key could be used and checked by default for "auto" support of this when something has not been specified? A complicating / cool thing (depending on how you look at it) would be automatic indication that a package version is installed if it was installed independent of chocolatey. |
I think this can be easily handled by a marker, plus cleaning up any packages that have the presence of this marker. |
I agree and that approach benefits from not creating additional package requirements. However, what I am suggesting takes steps toward making "chocolatey installed" and "OS/Setup.exe installed" represent the same factual data whenever possible. When I first started using Chocolatey this was my defacto expectation because most software inventory relies on Windows to tell what is installed. Another way to think of it is "if you compare the inventory of actual software on a computer via Windows" to "the inventory of a package manager managing some of the software", there should not be the opportunity for the package manager to claim something is installed or not installed in it's own data layer" While it's possible to always try to keep another indicator in sync with the Windows indicators- it seems like a labor intensive and error prone future. Passing through to Windows for this information (whenever possible) seems like a great way to avoid discrepancies. This is more of a roadmap thought - not suggesting refactoring code in the near term. |
I couldn't find this when #383 was logged (was looking for pending), so I updated that one. I think we will close that one as a dupe and update the title of this one. |
Another thing we need to check with this is if the nupkg file is corrupt when checking for existing installs. If you have a shaky connection it may create the nupkg but it may not get the entire thing downloaded, causing it to corrupt itself. This is #717. |
This is complete and will go out in the next beta after today. |
It will be available in 0.9.10. |
Related to #567. |
Once a package install/upgrade is passed from NuGet Core to Chocolatey, we are in a pending state where the package files exist but more work is to be done. Create a pending file for the package that tells Chocolatey that the package is not yet finished installing in case it gets interrupted for some reason. Also ensure that the pending file is cleaned up if the package installation is successful.
Manage tasks so they are loaded and ready and torn down when no longer needed.
Send an event message before and after running the command. In most instances the post run message will come through, there may be some cases where the system exits prior to the post run happening.
If any packages are in a pending state, it means the install did not complete successfully, so those packages should not actually be considered "installed". Those pending packages should be removed with a warning.
* stable: (GH-198) Remove existing pending packages (GH-198) Send pre/post run messages (GH-198) Manage tasks (GH-198) Set and remove a pending file (GH-198) Add ITask - rename existing messages (GH-515) runtime switches for autouninstaller (GH-706) New handles folder depth appropriately (GH-737) Use built-in template
If the package install directory is unknown, it means that the package already did not install successfully, so don't take any action on setting the pendingFile. Do the same during the removal of the pending file.
* stable: (GH-198) Only add pending if directory is known
It would be nice if Chocolatey had a transactional approach to whether a package is considered installed. Currently if I abort a package shortly after it starts - re running says it is installed.
I know I can use -Force to override - but it is a bit counter intuitive. I assume Chocolatey is using the existence of the package folder for "installed" and that this folder is created at the start of an install.
What if a tag file like InstallCompleted.txt was added to the package folder upon an error free completion?
This simple change would allow chocolatey to have a more "transactional" approach to "installed" marking without too much change or effort.
The text was updated successfully, but these errors were encountered: