FullStatus API when machine or unit is StatusDown

Menno Smits menno.smits at canonical.com
Mon May 19 01:55:42 UTC 2014


I'm working on a change to make "juju status" report the remote unit when a
relation hook fails (https://bugs.launchpad.net/juju-core/+bug/1194481).

During this work I've noticed that the FullStatus client API does some
munging of the agent state info string if the agent appears to be dead but
shouldn't be. It replaces the agent state info string with "(status: status
info)" (note the parens) and then changes the returned status to
StatusDown. You've probably noticed juju status strings with parens around
them before - this is why.

This code is at state/apiserver/client/status.go:540.

This is problematic for two reasons:

   1. the client API code is making formatting decisions that should be
   left up to the client. In the case of the ticket I'm working on, the juju
   status command handler ends up having to detect and unpick the parens in
   status string while generating the status output so that it can correctly
   append the remote unit name. This is easy enough but ugly and feels wrong.
   2. because the munging is done within the FullStatus API call, clients
   that are consuming events via a watcher will not see the munged status and
   info. If a client was to use both a watcher and FullStatus, it could see
   different status values for a unit or machine between the two APIs.

What I'd like to do is not have the client API munge the status info string
and instead use the StatusData map to report the record the original
status. When a unit or machine status is StatusDown a client can look in
StatusData for the pre-agent-down status if it wants it.

It would also be good to move the "if agent down set the status to
StatusDown" logic to somewhere deeper so that all clients get a consistent
view of the status. I can live with it if this isn't feasible however -
this part isn't necessary to get the ticket done.

I'm concerned that this change may impact the GUI. As far as I can tell the
GUI doesn't call FullStatus so any changes to that API shouldn't affect it
(please correct me if I'm wrong). Changing how StatusDown is set however
will probably impact the GUI.

Thoughts?

- Menno
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/juju-dev/attachments/20140519/8621792a/attachment.html>


More information about the Juju-dev mailing list