<div dir="ltr">I'm working on a change to make "juju status" report the remote unit when a relation hook fails (<a href="https://bugs.launchpad.net/juju-core/+bug/1194481">https://bugs.launchpad.net/juju-core/+bug/1194481</a>).<br>
<div><br></div><div>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.<br>
</div><div><br></div><div>This code is at state/apiserver/client/status.go:540.</div><div><br></div><div>This is problematic for two reasons:</div><div><ol><li>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.</li>
<li>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.</li>
</ol><div>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. </div>
<div><br></div><div>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.</div>
</div><div><br></div><div>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.</div>
<div><br></div><div>Thoughts?</div><div><br></div><div>- Menno</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div></div>