LEFT | RIGHT |
1 package main | 1 package main |
2 | 2 |
3 import ( | 3 import ( |
4 "fmt" | 4 "fmt" |
5 "launchpad.net/gnuflag" | 5 "launchpad.net/gnuflag" |
6 "launchpad.net/juju-core/cmd" | 6 "launchpad.net/juju-core/cmd" |
7 "launchpad.net/juju-core/environs/agent" | 7 "launchpad.net/juju-core/environs/agent" |
8 _ "launchpad.net/juju-core/environs/ec2" | 8 _ "launchpad.net/juju-core/environs/ec2" |
| 9 _ "launchpad.net/juju-core/environs/openstack" |
9 "launchpad.net/juju-core/log" | 10 "launchpad.net/juju-core/log" |
10 "launchpad.net/juju-core/state" | 11 "launchpad.net/juju-core/state" |
11 » "launchpad.net/juju-core/state/api" | 12 » "launchpad.net/juju-core/state/apiserver" |
12 "launchpad.net/juju-core/worker" | 13 "launchpad.net/juju-core/worker" |
13 "launchpad.net/juju-core/worker/firewaller" | 14 "launchpad.net/juju-core/worker/firewaller" |
14 "launchpad.net/juju-core/worker/provisioner" | 15 "launchpad.net/juju-core/worker/provisioner" |
15 "launchpad.net/tomb" | 16 "launchpad.net/tomb" |
16 "time" | 17 "time" |
17 ) | 18 ) |
18 | 19 |
19 var retryDelay = 3 * time.Second | 20 var retryDelay = 3 * time.Second |
20 | 21 |
21 // MachineAgent is a cmd.Command responsible for running a machine agent. | 22 // MachineAgent is a cmd.Command responsible for running a machine agent. |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 // If the configuration does not have the required information, | 168 // If the configuration does not have the required information, |
168 // it is currently not a recoverable error, so we kill the whole | 169 // it is currently not a recoverable error, so we kill the whole |
169 // agent, potentially enabling human intervention to fix | 170 // agent, potentially enabling human intervention to fix |
170 // the agent's configuration file. In the future, we may retrieve | 171 // the agent's configuration file. In the future, we may retrieve |
171 // the state server certificate and key from the state, and | 172 // the state server certificate and key from the state, and |
172 // this should then change. | 173 // this should then change. |
173 if len(conf.StateServerCert) == 0 || len(conf.StateServerKey) == 0 { | 174 if len(conf.StateServerCert) == 0 || len(conf.StateServerKey) == 0 { |
174 return &fatalError{"configuration does not have state server cer
t/key"} | 175 return &fatalError{"configuration does not have state server cer
t/key"} |
175 } | 176 } |
176 log.Printf("cmd/jujud: running API server job") | 177 log.Printf("cmd/jujud: running API server job") |
177 » srv, err := api.NewServer(st, fmt.Sprintf(":%d", conf.APIPort), conf.Sta
teServerCert, conf.StateServerKey) | 178 » srv, err := apiserver.NewServer(st, fmt.Sprintf(":%d", conf.APIPort), co
nf.StateServerCert, conf.StateServerKey) |
178 if err != nil { | 179 if err != nil { |
179 return err | 180 return err |
180 } | 181 } |
181 select { | 182 select { |
182 case <-a.tomb.Dying(): | 183 case <-a.tomb.Dying(): |
183 case <-srv.Dead(): | 184 case <-srv.Dead(): |
184 log.Printf("jujud: API server has died: %v", srv.Stop()) | 185 log.Printf("jujud: API server has died: %v", srv.Stop()) |
185 } | 186 } |
186 return srv.Stop() | 187 return srv.Stop() |
187 } | 188 } |
LEFT | RIGHT |