~ubuntu-branches/ubuntu/wily/juju-core/wily

« back to all changes in this revision

Viewing changes to src/launchpad.net/juju-core/state/apiserver/client/status.go

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2014-02-28 16:53:15 UTC
  • mfrom: (1.1.19)
  • Revision ID: package-import@ubuntu.com-20140228165315-g8n1ds0jrtekhxq6
Tags: 1.17.4-0ubuntu1
* New upstream point release (LP: #1261628):
  - https://launchpad.net/juju-core/trunk/1.17.4
  - d/control: Prefer juju-mongodb over mongodb-server for juju-local
    package.

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
        "launchpad.net/juju-core/state/statecmd"
11
11
)
12
12
 
13
 
func (c *Client) Status(args params.StatusParams) (api.Status, error) {
 
13
// FullStatus gives the information needed for juju status over the api
 
14
func (c *Client) FullStatus(args params.StatusParams) (api.Status, error) {
14
15
        conn, err := juju.NewConnFromState(c.api.state)
15
16
        if err != nil {
16
17
                return api.Status{}, err
19
20
        status, err := statecmd.Status(conn, args.Patterns)
20
21
        return *status, err
21
22
}
 
23
 
 
24
// Status is a stub version of FullStatus that was introduced in 1.16
 
25
func (c *Client) Status() (api.LegacyStatus, error) {
 
26
        var legacyStatus api.LegacyStatus
 
27
        status, err := c.FullStatus(params.StatusParams{})
 
28
        if err != nil {
 
29
                return legacyStatus, err
 
30
        }
 
31
 
 
32
        legacyStatus.Machines = make(map[string]api.LegacyMachineStatus)
 
33
        for machineName, machineStatus := range status.Machines {
 
34
                legacyStatus.Machines[machineName] = api.LegacyMachineStatus{
 
35
                        InstanceId: string(machineStatus.InstanceId),
 
36
                }
 
37
        }
 
38
        return legacyStatus, nil
 
39
}