-
Notifications
You must be signed in to change notification settings - Fork 883
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Warn when signal is handled (#5186)
Cloud-init is expected to run to completion. It does not expect to be stopped or restarted. Therefore, cloud-init should loudly warn when this happens so that the user is aware that the unexpected has happened. Problems: - When systemd stops cloud-init, no warning is logged. - When systemd restarts cloud-init, status info and return code from the current stage is lost. The net effect of these problems is that when cloud-init is restarted no warning is logged, and cloud-init status indicates no problem. Communicate unexpected state by: - Increase signal handling log level to ERROR, add log to stderr. - Write status.json before exiting when sys.exit() is called. - Warn when status.json contains existing data when the stage starts[1]. - Append existing errors and recoverable status.json errors rather than overwriting[2]. This should make cloud-init properly warn in status output and logs that something is amiss. [1] This should never happen and indicates that something restarted the service. When cloud-init doesn't have the opportunity to handle a signal (SIGKILL), other mitigations will fail. [2] Pre-existing warnings were previously silently lost from `cloud-init status`'s output. Fixes GH-5190
- Loading branch information
Showing
4 changed files
with
220 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters