Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(726)

Delta Between Two Patch Sets: cmd/juju/status.go

Issue 6447054: state: implement MachineInfoWatcher
Left Patch Set: state: implement MachineInfoWatcher Created 11 years, 8 months ago
Right Patch Set: state: implement MachineInfoWatcher Created 11 years, 8 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « [revision details] ('k') | environs/jujutest/livetests.go » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
1 package main 1 package main
2 2
3 import ( 3 import (
4 "fmt" 4 "fmt"
5 "strconv" 5 "strconv"
6 6
7 "launchpad.net/gnuflag" 7 "launchpad.net/gnuflag"
8 "launchpad.net/juju-core/cmd" 8 "launchpad.net/juju-core/cmd"
9 "launchpad.net/juju-core/environs" 9 "launchpad.net/juju-core/environs"
10 "launchpad.net/juju-core/juju" 10 "launchpad.net/juju-core/juju"
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 v[s.Name()] = s 118 v[s.Name()] = s
119 } 119 }
120 return v, nil 120 return v, nil
121 } 121 }
122 122
123 // processMachines gathers information about machines. 123 // processMachines gathers information about machines.
124 func processMachines(machines map[int]*state.Machine, instances map[string]envir ons.Instance) (map[int]interface{}, error) { 124 func processMachines(machines map[int]*state.Machine, instances map[string]envir ons.Instance) (map[int]interface{}, error) {
125 r := make(map[int]interface{}) 125 r := make(map[int]interface{})
126 for _, m := range machines { 126 for _, m := range machines {
127 instid, err := m.InstanceId() 127 instid, err := m.InstanceId()
128 » » if err, ok := err.(*state.NoInstanceIdError); ok { 128 » » if err, ok := err.(*state.NotFoundError); ok {
129 r[m.Id()] = map[string]interface{}{ 129 r[m.Id()] = map[string]interface{}{
130 "instance-id": "pending", 130 "instance-id": "pending",
131 } 131 }
132 } else if err != nil { 132 } else if err != nil {
133 return nil, err 133 return nil, err
134 } else { 134 } else {
135 instance, ok := instances[instid] 135 instance, ok := instances[instid]
136 if !ok { 136 if !ok {
137 // Double plus ungood. There is an instance id r ecorded for this machine in the state, 137 // Double plus ungood. There is an instance id r ecorded for this machine in the state,
138 // yet the environ cannot find that id.· 138 // yet the environ cannot find that id.·
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 func jsonify(r map[string]interface{}) map[string]map[string]interface{} { 204 func jsonify(r map[string]interface{}) map[string]map[string]interface{} {
205 m := map[string]map[string]interface{}{ 205 m := map[string]map[string]interface{}{
206 "services": r["services"].(map[string]interface{}), 206 "services": r["services"].(map[string]interface{}),
207 "machines": make(map[string]interface{}), 207 "machines": make(map[string]interface{}),
208 } 208 }
209 for k, v := range r["machines"].(map[int]interface{}) { 209 for k, v := range r["machines"].(map[int]interface{}) {
210 m["machines"][strconv.Itoa(k)] = v 210 m["machines"][strconv.Itoa(k)] = v
211 } 211 }
212 return m 212 return m
213 } 213 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b