Merge lp:~gz/juju-core/status_api_1.16_compat into lp:~go-bot/juju-core/trunk
Status: | Merged |
---|---|
Approved by: | Martin Packman |
Approved revision: | no longer in the source branch. |
Merged at revision: | 2350 |
Proposed branch: | lp:~gz/juju-core/status_api_1.16_compat |
Merge into: | lp:~go-bot/juju-core/trunk |
Diff against target: |
139 lines (+102/-6) 3 files modified
state/api/client.go (+25/-5) state/apiserver/client/status.go (+19/-1) state/apiserver/client/status_test.go (+58/-0) |
To merge this branch: | bzr merge lp:~gz/juju-core/status_api_1.16_compat |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Juju Engineering | Pending | ||
Review via email:
|
Commit message
Restore juju status compatibility with 1.16
A stub 'Status' api call was included in 1.16 though not used
in our codebase. It does break the fallback logic to switch
and operate on state directly when talking to a 1.16 state
server however. This branch reintroduces the old call with
the existing name, and uses 'FullStatus' for actual status
api.
https:/
R=dimitern
Description of the change
Restore juju status compatibility with 1.16
A stub 'Status' api call was included in 1.16 though not used
in our codebase. It does break the fallback logic to switch
and operate on state directly when talking to a 1.16 state
server however. This branch reintroduces the old call with
the existing name, and uses 'FullStatus' for actual status
api.
Reviewers: mp+207482_ code.launchpad. net,
Message:
Please take a look.
Description:
Restore juju status compatibility with 1.16
A stub 'Status' api call was included in 1.16 though not used
in our codebase. It does break the fallback logic to switch
and operate on state directly when talking to a 1.16 state
server however. This branch reintroduces the old call with
the existing name, and uses 'FullStatus' for actual status
api.
I want to add a test for the legacy Status method added in /client/ status. go just to exercise that
state/apiserver
code. Where should it go?
https:/ /code.launchpad .net/~gz/ juju-core/ status_ api_1.16_ compat/ +merge/ 207482
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/66590043/
Affected files (+41, -2 lines): /client/ status. go
A [revision details]
M state/api/client.go
M state/apiserver
Index: [revision details] 20140220084222- vp7yz0ga1ligfdk q
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision: tarmac-
+New revision: <email address hidden>
Index: state/api/client.go api/client. go' StatusParams{ Patterns: patterns} LegacyMachineSt atus
=== modified file 'state/
--- state/api/client.go 2014-01-30 02:20:09 +0000
+++ state/api/client.go 2014-02-20 15:56:17 +0000
@@ -77,7 +77,26 @@
func (c *Client) Status(patterns []string) (*Status, error) {
var s Status
p := params.
- if err := c.st.Call("Client", "", "Status", p, &s); err != nil {
+ if err := c.st.Call("Client", "", "FullStatus", p, &s); err != nil {
+ return nil, err
+ }
+ return &s, nil
+}
+
+// LegacyMachineStatus holds just the instance-id of a machine.
+type LegacyMachineStatus struct {
+ InstanceId string
+}
+
+// LegacyStatus holds minimal information on the status of a juju
environment.
+type LegacyStatus struct {
+ Machines map[string]
+}
+
+// LegacyStatus is a stub version of Status that 1.16 introduced.
+func (c *Client) LegacyStatus() (*LegacyStatus, error) {
+ var s LegacyStatus
+ if err := c.st.Call("Client", "", "Status", nil, &s); err != nil {
return nil, err
}
return &s, nil
Index: state/apiserver /client/ status. go apiserver/ client/ status. go' /client/ status. go 2013-12-19 18:13:24 +0000 /client/ status. go 2014-02-20 15:56:17 +0000 net/juju- core/state/ statecmd"
=== modified file 'state/
--- state/apiserver
+++ state/apiserver
@@ -10,7 +10,8 @@
"launchpad.
)
-func (c *Client) Status(args params. StatusParams) (api.Status, error) { StatusParams) (api.Status, error) { mState( c.api.state) Status( conn, args.Patterns) params. StatusParams{ })
+// FullStatus gives the information needed for juju status over the api
+func (c *Client) FullStatus(args params.
conn, err := juju.NewConnFro
if err != nil {
return api.Status{}, err
@@ -19,3 +20,20 @@
status, err := statecmd.
return *status, err
}
+
+// Status is a stub version of FullStatus that was introduced in 1.16
+func (c *Client) Status() (api.LegacyStatus, error) {
+ var legacyStatus api.LegacyStatus
+ status, err := c.FullStatus(
+ if err != nil {
+ return legacyStat...