-
Notifications
You must be signed in to change notification settings - Fork 903
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
Exit when reboot is detected - w/350 for pending & w/1604 on dependency package requiring reboot #1038
Comments
Thanks! Release NotesTo turn on this feature, please run When Package Exit codes are turned on (#512), we'll exit indicating reboot necessary but not complete:
Both mean reboot and then run again. |
Similar to #913, would probably share most of the implementation. |
When finding a pending reboot before doing anything, we will fail with 350 - https://docs.microsoft.com/en-us/windows/desktop/debug/system-error-codes--0-499-
|
Currently we are looking for what exit code to use when we've installed some dependencies, but have not installed everything because there is a reboot required in the middle. We've come to 3011, 3017, and a couple of others, but none are ideal in the definition. https://docs.microsoft.com/en-us/windows/desktop/debug/system-error-codes--1700-3999-
|
1602 could be an option, but it could also be indicative of other areas where a user cancels the install. |
https://docs.microsoft.com/en-us/windows/desktop/debug/system-error-codes--1300-1699-
|
1604 looks like a Winner here |
See above, we've already identified 350 |
Sorry, I missed that one. |
No worries. We have identified two codes - 350 for exit without doing anything, and 1604 for exit if some work has been completed, but not finished. Both mean reboot and then run again. |
Updated #1038 (comment) above |
There is now both a parameter and a feature flag which will allow halting the install/upgrade/uninstall of a package, when a reboot request is returned from one of it's dependencies. When this occurs, an ApplicationException will be thrown, and the package exit code, either 1641 (restart initiated), or 3010 (restart requested) will be returned. This could then be inspected to decide when a reboot should actually be performed, before continuing with the remainder of the installation. The implementation of this ability followed closely to how the stoponfirstfailure parameter and feature flag are implemented.
There are now parameters and a feature flag which will allow halting/overriding the install/upgrade/uninstall of a package, when a reboot request is returned from one of it's dependencies. When this occurs, an ApplicationException will be thrown, along with a specific exit code, either 350 (pending reboot discovered prior to running), or 1604 (some work completed prior to restart request) will be returned. This could then be inspected to decide when a reboot should actually be performed, before continuing with the remainder of the installation. The initial implementation of this ability followed closely to how the stoponfirstfailure parameter and feature flag are implemented, and then subsequent changes added to the implementation.
There are now parameters and a feature flag which will allow halting/overriding the install/upgrade/uninstall of a package, when a reboot request is returned from one of it's dependencies. When this occurs, an ApplicationException will be thrown, along with a specific exit code, either 350 (pending reboot discovered prior to running), or 1604 (some work completed prior to restart request) will be returned. This could then be inspected to decide when a reboot should actually be performed, before continuing with the remainder of the installation. The initial implementation of this ability followed closely to how the stoponfirstfailure parameter and feature flag are implemented, and then subsequent changes added to the implementation.
There are now parameters and a feature flag which will allow halting/overriding the install/upgrade/uninstall of a package, when a reboot request is returned from one of it's dependencies. When this occurs, an ApplicationException will be thrown, along with a specific exit code, either 350 (pending reboot discovered prior to running), or 1604 (some work completed prior to restart request) will be returned. This could then be inspected to decide when a reboot should actually be performed, before continuing with the remainder of the installation. The initial implementation of this ability followed closely to how the stoponfirstfailure parameter and feature flag are implemented, and then subsequent changes added to the implementation.
There are now parameters and a feature flag which will allow halting/overriding the install/upgrade/uninstall of a package, when a reboot request is returned from one of it's dependencies. When this occurs, an ApplicationException will be thrown, along with a specific exit code, either 350 (pending reboot discovered prior to running), or 1604 (some work completed prior to restart request) will be returned. This could then be inspected to decide when a reboot should actually be performed, before continuing with the remainder of the installation. The initial implementation of this ability followed closely to how the stoponfirstfailure parameter and feature flag are implemented, and then subsequent changes added to the implementation.
There are now parameters and a feature flag which will allow halting/overriding the install/upgrade/uninstall of a package, when a reboot request is returned from one of it's dependencies. When this occurs, an ApplicationException will be thrown, along with a specific exit code, either 350 (pending reboot discovered prior to running), or 1604 (some work completed prior to restart request) will be returned. This could then be inspected to decide when a reboot should actually be performed, before continuing with the remainder of the installation. The initial implementation of this ability followed closely to how the stoponfirstfailure parameter and feature flag are implemented, and then subsequent changes added to the implementation.
When executing Chocolatey commands, it is well known that a pending reboot requirement can prevent a succesful operation. This adds the ability to enable detection of a pending reboot (implemented as a global validation), which will then halt execution of the command. This addition doesn't require that the usePackageExitCodes feature be enabled, but rather, it inspecting the current state of the system, via the registry to determine if a reboot is required. These checks will only be performed when running on the Windows Operating System.
There are now parameters and a feature flag which will allow halting/overriding the install/upgrade/uninstall of a package, when a reboot request is returned from one of it's dependencies. When this occurs, an ApplicationException will be thrown, along with a specific exit code, either 350 (pending reboot discovered prior to running), or 1604 (some work completed prior to restart request) will be returned. This could then be inspected to decide when a reboot should actually be performed, before continuing with the remainder of the installation.
When executing Chocolatey commands, it is well known that a pending reboot requirement can prevent a succesful operation. This adds the ability to enable detection of a pending reboot (implemented as a global validation), which will then halt execution of the command. This addition doesn't require that the usePackageExitCodes feature be enabled, but rather, it inspecting the current state of the system, via the registry to determine if a reboot is required. These checks will only be performed when running on the Windows Operating System.
There are now parameters and a feature flag which will allow halting/overriding the install/upgrade/uninstall of a package, when a reboot request is returned from one of it's dependencies. When this occurs, an ApplicationException will be thrown, along with a specific exit code, either 350 (pending reboot discovered prior to running), or 1604 (some work completed prior to restart request) will be returned. This could then be inspected to decide when a reboot should actually be performed, before continuing with the remainder of the installation.
When executing Chocolatey commands, it is well known that a pending reboot requirement can prevent a succesful operation. This adds the ability to enable detection of a pending reboot (implemented as a global validation), which will then halt execution of the command. This addition doesn't require that the usePackageExitCodes feature be enabled, but rather, it inspecting the current state of the system, via the registry to determine if a reboot is required. These checks will only be performed when running on the Windows Operating System.
There are now parameters and a feature flag which will allow halting/overriding the install/upgrade/uninstall of a package, when a reboot request is returned from one of it's dependencies. When this occurs, an ApplicationException will be thrown, along with a specific exit code, either 350 (pending reboot discovered prior to running), or 1604 (some work completed prior to restart request) will be returned. This could then be inspected to decide when a reboot should actually be performed, before continuing with the remainder of the installation.
* stable: (GH-1655) make virtual methods for outdated / package service (GH-1747) Fix: passing timeout switch of 0 is ignored (GH-1746) Update XML comments / formatting (GH-1746) update logging for validation (GH-1038) Stop operation on package reboot request (GH-1038) Stop execution if pending reboot (GH-1746) Add concept of global validation (maint) Corrected white space
This has been completed and will be released with 0.10.12. |
For exit on reboot detected, it's actually best to have it on as it makes things more reliable for installations. Remove the note that mentions otherwise.
* stable: (doc) add exit codes to gen doc headings (doc) update generated docs (version) 0.10.12 (doc) fix grammar (GH-1038) remove note on off recommendation (GH-1746) allow shutting off validation warnings (doc) update release notes for licensed extension (maint) whitespace (doc) update release notes (maint) formatting (GH-1758)(doc) provide exit code docs (doc) info - add usage / examples (doc) outdated - note ignore unfound (doc) scripting - point to scripting reference (doc) scripting - how to get exit code w/powershell (GH-1724) search - exit 2 on no results (GH-1758) control enhanced exit codes w/feature (doc) update release notes for 0.10.12 release (doc) update older release notes
As per https://groups.google.com/forum/#!topic/chocolatey/jP4cv8TDUcU, it's probably a good idea to add a switch so that install/upgrade will halt if a dependency requires a reboot. For example, I have a package that has a dependency on PowerShell 3+ - chocolately installed PowerShell v5 but then logged this and then continued to install packages with PowerShell 2 (and subsequently failed):
2016-11-02 12:05:55,829 [INFO ] - PowerShell.5.0 has been installed.
2016-11-02 12:05:55,829 [INFO ] -
2016-11-02 12:05:55,844 [WARN ] - WARNING: PowerShell.5.0 requires a reboot to complete the installation.
2016-11-02 12:05:55,844 [DEBUG] - Built-in PowerShell host called with ['[System.Threading.Thread]::CurrentThread.CurrentCulture = '';[System.Threading.Thread]::CurrentThread.CurrentUICulture = ''; & import-module -name 'C:\ProgramData\chocolatey\helpers\chocolateyInstaller.psm1'; & 'C:\ProgramData\chocolatey\helpers\chocolateyScriptRunner.ps1' -packageScript 'C:\ProgramData\chocolatey\lib\PowerShell\tools\ChocolateyInstall.ps1' -installArguments '' -packageParameters '''] exited with '3010'.
2016-11-02 12:05:55,844 [DEBUG] - Calling command ['"C:\Windows\System32\shutdown.exe" /a']
2016-11-02 12:05:55,870 [DEBUG] - Command ['"C:\Windows\System32\shutdown.exe" /a'] exited with '1116'
The text was updated successfully, but these errors were encountered: