Skip to content
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

feat: wire up unit status with presence #19158

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

SimonRichardson
Copy link
Member

@SimonRichardson SimonRichardson commented Mar 11, 2025

This is the last of the PRs to wire up unit status (agent and workload) with the presence data. This is quite easy now that we have the presence information in the database, the tricky part is ensuring that we correctly handle the status for things like allocating. If the unit is allocating, it won't yet have recorded the presence, in that case, we have to fake the display status when calling juju status. This won't impact the underlying data, just the display nature.


This pull request includes several changes to improve the handling of unit and application statuses in the codebase. The most important changes involve adding new methods to retrieve both unit and agent display statuses, modifying existing status retrieval methods to handle cases where status information might be missing, and updating the corresponding tests and mock implementations.

New Methods and Enhancements:

Status Handling Improvements:

Test Updates:

Mock Implementations:

These changes collectively enhance the robustness of status handling in the application, ensuring that missing status information is appropriately managed and that the new UnitStatusInfo structure is consistently used across the codebase.

QA steps

It should switch between the statuses correctly.

$ juju bootstrap lxd test
$ watch juju status -m controller

Deploying an application to a model, should correctly display allocating and not agent lost.

$ juju add-model default
$ watch juju status

In another terminal (as it can be fast!):

$ juju deploy ubuntu

Bonus points

Whilst still calling watch juju status:

$ juju ssh 0
$ sudo systemctl stop jujud-machine-0.service

Status should now switch correctly to lost for the agent and unknown for the application and workload:

$ sudo systemctl start jujud-machine-0.service

It should come back - you can flip-flop between the two states.

Links

Jira card: JUJU-7652

The service methods now have to deal with if the unit agent or
workload is present or not. If they're not present then it will
show different error status and messages.
This adds the presence information to the state calls in application.
If the unit agent is allocating, don't allow it to show that it's
lost. Instead, pretend that it's present and keep the old behaviour
of juju status.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants