Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The one major functional change in this commit is around how we detect running vs error states. Status reporting has a fundamental problem in that we can't accurately tell if cloud-init is done because cloud-init is actually several processes. There isn't always a way to tell whether a service isn't running because it simply hasn't started yet vs the service being blocked/crashed and will never start/finish. In the past, if any of the cloud-init services reported an error, we would assume that cloud-init as a whole has crashed and report that cloud-init is "done", but with error. This commit flips that logic to assume that cloud-init is always running unless we see indication that cloud-init has completely finished. This means that `cloud-init status --wait` may run forever if cloud-init has crashed or is blocked on another service. This is preferable to returning early and potentially allowing provisioning scripts that wait for cloud-init to continue provisioning. On systemd-enabled systems, there is extra logic to inspect the state of the services, so this should rarely be a problem in practice. Additionally, this commit includes the following refactoring: - Split UXAppStatus into RunningStatus and ConditionStatus so they can be tracked independently - Simplify the tabular printing - On error print extended_status as "error - done" or "error - running" - Add several helper functions in `get_status_details` to simplify logic - Rename `_get_error_or_running_from_systemd` to `systemd_failed` and only return if error is detected - Change "is running" logic to be determined solely by the existence of the status.json and results.json files.
- Loading branch information