-
Notifications
You must be signed in to change notification settings - Fork 7
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
Hook handling for package exceptions #11
Comments
That sounds like a neat application of hooks! I was surprised it's not working, based on a quick read of the That may be intended, as I can see an argument that hooks are only expected to run after successful installations, but I'll check in with folk. If there is an issue or enhancement to be made, this issue would be more helpful on the chocolatey/choco repository, (rather than this repository, which is dedicated to hook-packages but not actually how they execute). |
Logging and monitoring was actually my original assumption as to the intention of hooks haha I can see where the expectation is that the post-* scripts only execute when successful. I had the thought of a concept for "error-install-*.ps1" that executes when an error is encountered during package installation. which could be advantageous but perhaps could also be pandora's box :-P i can also see this be particularly helpful for post-failure handling, like cleaning up parts of a failed install or initiating a reboot if one turned out to be necessary, or something more complex like if a reboot is necessary then scheduling a task to run on next start up, setting credentials to allow the next logon to be done without user intervention, then initiating a restart. I tried using the -ErrorVariable with the chocolatey install commands inside the package scripts but the variable did not seem to populate. |
This sounds more like the relm of boxstarter. |
I created a hook package that I'm still working on that sends telemetry data to Azure Application Insights. I got it working using custom events but hit a brick wall with error reporting as it seems post-*-all.ps1 doesn't execute if an install fails. My original intent had been to catch the error and send it back to App Insights.
The package usage data is helpful but a large part of the motivation for this came from having a central place to monitor for errors. Would like to see either it execute the post-*.ps1 scripts or perhaps an alternate hook for errors.
The text was updated successfully, but these errors were encountered: