Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Show the unit leader in status. #6350
Conversation
axw
approved these changes
Sep 29, 2016
LGTM, but I'd prefer if we didn't display the * for single-unit applications.
| @@ -89,6 +89,7 @@ type UnitStatus struct { | ||
| PublicAddress string `json:"public-address"` | ||
| Charm string `json:"charm"` | ||
| Subordinates map[string]UnitStatus `json:"subordinates"` | ||
| + Leader bool `json:"leader"` |
| @@ -177,6 +177,9 @@ func FormatTabular(writer io.Writer, forceColor bool, value interface{}) error { | ||
| if agentDoing != "" { | ||
| message = fmt.Sprintf("(%s) %s", agentDoing, message) | ||
| } | ||
| + if u.Leader { |
axw
Sep 29, 2016
Member
how about we don't display this if there's only one unit? it's noisy/uninteresting in that case.
howbazaar
Sep 30, 2016
Owner
There is no nice way to not do this. Discussed on the bug with sabdfl, and agreed that at least for the first cut, we always show it.
| @@ -1814,7 +1826,7 @@ var statusTests = []testCase{ | ||
| // scoped on wordpress/0 | ||
| scopedExpect{ | ||
| - "subordinates scoped on logging", |
axw
Sep 29, 2016
Member
I think this was correct? The subordinate is scoped to the logging relation of the wordpress application?
howbazaar
Sep 30, 2016
Owner
This was a copy/paste error from a previous test. Updated the comment of the test to match the args passed to status, and the comment just before the 'scopedExpect'
|
$$merge$$ |
|
Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju |
howbazaar commentedSep 28, 2016
•
Edited 1 time
-
howbazaar
Sep 28, 2016
Addresses http://pad.lv/1620063.
Whether the unit is the leader or not is now returned in the FullStatus. The leader is indicated in tabular output with an * at the end of the unit name. YAML and JSON have a map value called "leader" that is only added when it is true.
The addition of the field into the FullStatus output does not need any facade version bump. It is optional, and the code handles it if it is missing by just not indicating a leader. This has been confirmed by running the new client against an old server.
QA