Add an uninstall hook · Issue #6481 · habitat-sh/habitat
https://github.com/habitat-sh/habitat/issues/6481
mwrock commented Apr 25, 2019 commented Now that we have install hooks for performing one-time machine wide installation tasks AND an uninstall command. It makes sense to have an uninstall hook that would be invoked at uninstall time to uninstall any machine state that was installed in the install hook. Foe example, core/sqlserver would uninstall its sql server instance from the OS. The text was updated successfully, but these errors were encountered: 👍 2 added labels added the label Copy link Contributor Authormwrock commented Jun 8, 2020 commented There is an interestingly problematic use case here. Here are some notes on the case and a proposed solution. Would love feedback.davidMcneil commented Jun 9, 2020 commented Basically we should never automatically run a script that can uninstall global state without some kind of willful act from a user. If there is only one version of the package installed when the uninstall is taking place would it be ok to run the uninstall hook? I think it would be.
The --keep-latest flag adds some nuance. If the user sets --keep-latest to 0 it would be safe to run the uninstall hook.
Maybe the logic could be: If an uninstall operation would end with any versions of the package still installed a warning is emitted stating that the uninstall hook will not be run (if the package has an uninstall hook).
If an uninstall operation would remove all versions of the package run the uninstall hook for each package version from oldest to newest
If the --ignore-uninstall-hook is set no uninstall hooks are run Loading Sorry, something went wrong. Copy link Contributor Author
DA: 24 PA: 31 MOZ Rank: 71