OLD | NEW |
1 // Copyright 2013 Canonical Ltd. | 1 // Copyright 2013 Canonical Ltd. |
2 // Licensed under the AGPLv3, see LICENCE file for details. | 2 // Licensed under the AGPLv3, see LICENCE file for details. |
3 | 3 |
4 package manual | 4 package manual |
5 | 5 |
6 import ( | 6 import ( |
7 "bytes" | 7 "bytes" |
8 "errors" | 8 "errors" |
9 "fmt" | 9 "fmt" |
10 "io" | 10 "io" |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 | 123 |
124 func splitUserHost(host string) (string, string) { | 124 func splitUserHost(host string) (string, string) { |
125 if at := strings.Index(host, "@"); at != -1 { | 125 if at := strings.Index(host, "@"); at != -1 { |
126 return host[:at], host[at+1:] | 126 return host[:at], host[at+1:] |
127 } | 127 } |
128 return "", host | 128 return "", host |
129 } | 129 } |
130 | 130 |
131 func recordMachineInState( | 131 func recordMachineInState( |
132 client *api.Client, machineParams params.AddMachineParams) (machineId st
ring, err error) { | 132 client *api.Client, machineParams params.AddMachineParams) (machineId st
ring, err error) { |
133 » results, err := client.AddMachines([]params.AddMachineParams{machinePara
ms}) | 133 » // Note: we explicitly use AddMachines1dot18 rather than AddMachines to
preserve |
| 134 » // backwards compatibility; we do not require any of the new features of
AddMachines |
| 135 » // here. |
| 136 » results, err := client.AddMachines1dot18([]params.AddMachineParams{machi
neParams}) |
134 if err != nil { | 137 if err != nil { |
135 return "", err | 138 return "", err |
136 } | 139 } |
137 // Currently, only one machine is added, but in future there may be seve
ral added in one call. | 140 // Currently, only one machine is added, but in future there may be seve
ral added in one call. |
138 machineInfo := results[0] | 141 machineInfo := results[0] |
139 if machineInfo.Error != nil { | 142 if machineInfo.Error != nil { |
140 return "", machineInfo.Error | 143 return "", machineInfo.Error |
141 } | 144 } |
142 return machineInfo.Machine, nil | 145 return machineInfo.Machine, nil |
143 } | 146 } |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 return buf.String(), nil | 244 return buf.String(), nil |
242 } | 245 } |
243 | 246 |
244 func runProvisionScript(script, host string, progressWriter io.Writer) error { | 247 func runProvisionScript(script, host string, progressWriter io.Writer) error { |
245 params := sshinit.ConfigureParams{ | 248 params := sshinit.ConfigureParams{ |
246 Host: "ubuntu@" + host, | 249 Host: "ubuntu@" + host, |
247 ProgressWriter: progressWriter, | 250 ProgressWriter: progressWriter, |
248 } | 251 } |
249 return sshinit.RunConfigureScript(script, params) | 252 return sshinit.RunConfigureScript(script, params) |
250 } | 253 } |
OLD | NEW |