Merge lp:~gz/juju-core/addservice_using_networks into lp:~go-bot/juju-core/trunk
- addservice_using_networks
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Martin Packman |
Approved revision: | no longer in the source branch. |
Merged at revision: | 2477 |
Proposed branch: | lp:~gz/juju-core/addservice_using_networks |
Merge into: | lp:~go-bot/juju-core/trunk |
Diff against target: |
331 lines (+54/-31) 13 files modified
cmd/juju/status_test.go (+1/-1) environs/jujutest/livetests.go (+1/-1) juju/conn_test.go (+1/-1) juju/deploy.go (+2/-1) juju/testing/conn.go (+5/-1) state/apiserver/charmrevisionupdater/testing/suite.go (+5/-5) state/apiserver/client/run_test.go (+4/-4) state/compat_test.go (+1/-1) state/conn_test.go (+4/-0) state/export_test.go (+5/-1) state/service_test.go (+10/-0) state/state.go (+2/-2) state/state_test.go (+13/-13) |
To merge this branch: | bzr merge lp:~gz/juju-core/addservice_using_networks |
Related bugs: | |
Related blueprints: |
Support MaaS VLANs in Juju
(Essential)
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Juju Engineering | Pending | ||
Review via email: mp+212635@code.launchpad.net |
Commit message
Add networks params to AddService
Append includeNetworks and excludeNetworks to AddService
function parameters, and updates callers appropriately.
New AddTestingServi
places and used for basic test.
https:/
R=dimitern
Description of the change
Add networks params to AddService
Append includeNetworks and excludeNetworks to AddService
function parameters, and updates callers appropriately.
New AddTestingServi
places and used for basic test.
Martin Packman (gz) wrote : | # |
Dimiter Naydenov (dimitern) wrote : | # |
LGTM, with one improvement: when no networks are to be given to a
service, passing nil instead of []string{} is better (for both args).
https:/
File cmd/juju/
https:/
cmd/juju/
"user-admin", ch, []string{}, []string{})
Just passing nil, nil should be enough.
https:/
File environs/
https:/
environs/
conn.State.
[]string{})
ditto (and all other places)
Go Bot (go-bot) wrote : | # |
Attempt to merge into lp:juju-core failed due to conflicts:
text conflict in state/service_
Go Bot (go-bot) wrote : | # |
The attempt to merge lp:~gz/juju-core/addservice_using_networks into lp:juju-core failed. Below is the output from the failed tests.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
? launchpad.
? launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
? launchpad.
? launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
? launchpad.
ok launchpad.
? launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
? launchpad.
ok launchpad.
? launchpad.
? launchpad.
? launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
? launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
? launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
? launchpad.
ok launchpad.
ok launchpad.
? launchpad.
ok launchpad.
ok launchpad.
o...
Go Bot (go-bot) wrote : | # |
The attempt to merge lp:~gz/juju-core/addservice_using_networks into lp:juju-core failed. Below is the output from the failed tests.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
? launchpad.
? launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
? launchpad.
? launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
? launchpad.
ok launchpad.
? launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
? launchpad.
ok launchpad.
? launchpad.
? launchpad.
? launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
? launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
? launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
? launchpad.
ok launchpad.
ok launchpad.
? launchpad.
ok launchpad.
ok launchpad.
Preview Diff
1 | === modified file 'cmd/juju/status_test.go' |
2 | --- cmd/juju/status_test.go 2014-01-24 14:52:58 +0000 |
3 | +++ cmd/juju/status_test.go 2014-03-25 16:12:36 +0000 |
4 | @@ -1626,7 +1626,7 @@ |
5 | func (as addService) step(c *gc.C, ctx *context) { |
6 | ch, ok := ctx.charms[as.charm] |
7 | c.Assert(ok, gc.Equals, true) |
8 | - _, err := ctx.st.AddService(as.name, "user-admin", ch) |
9 | + _, err := ctx.st.AddService(as.name, "user-admin", ch, nil, nil) |
10 | c.Assert(err, gc.IsNil) |
11 | } |
12 | |
13 | |
14 | === modified file 'environs/jujutest/livetests.go' |
15 | --- environs/jujutest/livetests.go 2014-03-17 18:46:17 +0000 |
16 | +++ environs/jujutest/livetests.go 2014-03-25 16:12:36 +0000 |
17 | @@ -452,7 +452,7 @@ |
18 | url := coretesting.Charms.ClonedURL(repoDir, mtools0.Version.Series, "dummy") |
19 | sch, err := conn.PutCharm(url, &charm.LocalRepository{Path: repoDir}, false) |
20 | c.Assert(err, gc.IsNil) |
21 | - svc, err := conn.State.AddService("dummy", "user-admin", sch) |
22 | + svc, err := conn.State.AddService("dummy", "user-admin", sch, nil, nil) |
23 | c.Assert(err, gc.IsNil) |
24 | units, err := juju.AddUnits(conn.State, svc, 1, "") |
25 | c.Assert(err, gc.IsNil) |
26 | |
27 | === modified file 'juju/conn_test.go' |
28 | --- juju/conn_test.go 2014-03-20 22:35:39 +0000 |
29 | +++ juju/conn_test.go 2014-03-25 16:12:36 +0000 |
30 | @@ -402,7 +402,7 @@ |
31 | curl := coretesting.Charms.ClonedURL(s.repo.Path, "quantal", "riak") |
32 | sch, err := s.conn.PutCharm(curl, s.repo, false) |
33 | c.Assert(err, gc.IsNil) |
34 | - svc, err := s.conn.State.AddService("testriak", "user-admin", sch) |
35 | + svc, err := s.conn.State.AddService("testriak", "user-admin", sch, nil, nil) |
36 | c.Assert(err, gc.IsNil) |
37 | units, err := juju.AddUnits(s.conn.State, svc, 2, "") |
38 | c.Assert(err, gc.IsNil) |
39 | |
40 | === modified file 'juju/deploy.go' |
41 | --- juju/deploy.go 2013-12-19 21:17:26 +0000 |
42 | +++ juju/deploy.go 2014-03-25 16:12:36 +0000 |
43 | @@ -49,7 +49,8 @@ |
44 | } |
45 | // TODO(fwereade): transactional State.AddService including settings, constraints |
46 | // (minimumUnitCount, initialMachineIds?). |
47 | - service, err := st.AddService(args.ServiceName, "user-admin", args.Charm) |
48 | + // TODO(gz): pass through real includeNetworks and excludeNetworks vals |
49 | + service, err := st.AddService(args.ServiceName, "user-admin", args.Charm, nil, nil) |
50 | if err != nil { |
51 | return nil, err |
52 | } |
53 | |
54 | === modified file 'juju/testing/conn.go' |
55 | --- juju/testing/conn.go 2014-03-07 22:45:37 +0000 |
56 | +++ juju/testing/conn.go 2014-03-25 16:12:36 +0000 |
57 | @@ -293,8 +293,12 @@ |
58 | } |
59 | |
60 | func (s *JujuConnSuite) AddTestingService(c *gc.C, name string, ch *state.Charm) *state.Service { |
61 | + return s.AddTestingServiceWithNetworks(c, name, ch, nil, nil) |
62 | +} |
63 | + |
64 | +func (s *JujuConnSuite) AddTestingServiceWithNetworks(c *gc.C, name string, ch *state.Charm, includeNetworks, excludeNetworks []string) *state.Service { |
65 | c.Assert(s.State, gc.NotNil) |
66 | - service, err := s.State.AddService(name, "user-admin", ch) |
67 | + service, err := s.State.AddService(name, "user-admin", ch, includeNetworks, excludeNetworks) |
68 | c.Assert(err, gc.IsNil) |
69 | return service |
70 | } |
71 | |
72 | === modified file 'state/apiserver/charmrevisionupdater/testing/suite.go' |
73 | --- state/apiserver/charmrevisionupdater/testing/suite.go 2014-01-17 00:06:37 +0000 |
74 | +++ state/apiserver/charmrevisionupdater/testing/suite.go 2014-03-25 16:12:36 +0000 |
75 | @@ -88,10 +88,10 @@ |
76 | } |
77 | |
78 | // AddService adds a service for the specified charm to state. |
79 | -func (s *CharmSuite) AddService(c *gc.C, charmName, serviceName string) { |
80 | +func (s *CharmSuite) AddService(c *gc.C, charmName, serviceName string, includeNetworks, excludeNetworks []string) { |
81 | ch, ok := s.charms[charmName] |
82 | c.Assert(ok, gc.Equals, true) |
83 | - _, err := s.State.AddService(serviceName, "user-admin", ch) |
84 | + _, err := s.State.AddService(serviceName, "user-admin", ch, includeNetworks, excludeNetworks) |
85 | c.Assert(err, gc.IsNil) |
86 | } |
87 | |
88 | @@ -127,12 +127,12 @@ |
89 | |
90 | // mysql is out of date |
91 | s.AddCharmWithRevision(c, "mysql", 22) |
92 | - s.AddService(c, "mysql", "mysql") |
93 | + s.AddService(c, "mysql", "mysql", nil, nil) |
94 | s.AddUnit(c, "mysql", "1") |
95 | |
96 | // wordpress is up to date |
97 | s.AddCharmWithRevision(c, "wordpress", 26) |
98 | - s.AddService(c, "wordpress", "wordpress") |
99 | + s.AddService(c, "wordpress", "wordpress", nil, nil) |
100 | s.AddUnit(c, "wordpress", "2") |
101 | s.AddUnit(c, "wordpress", "2") |
102 | // wordpress/0 has a version, wordpress/1 is unknown |
103 | @@ -140,6 +140,6 @@ |
104 | |
105 | // varnish is a charm that does not have a version in the mock store. |
106 | s.AddCharmWithRevision(c, "varnish", 5) |
107 | - s.AddService(c, "varnish", "varnish") |
108 | + s.AddService(c, "varnish", "varnish", nil, nil) |
109 | s.AddUnit(c, "varnish", "3") |
110 | } |
111 | |
112 | === modified file 'state/apiserver/client/run_test.go' |
113 | --- state/apiserver/client/run_test.go 2014-03-13 07:54:56 +0000 |
114 | +++ state/apiserver/client/run_test.go 2014-03-25 16:12:36 +0000 |
115 | @@ -76,16 +76,16 @@ |
116 | |
117 | func (s *runSuite) TestGetAllUnitNames(c *gc.C) { |
118 | charm := s.AddTestingCharm(c, "dummy") |
119 | - magic, err := s.State.AddService("magic", "user-admin", charm) |
120 | + magic, err := s.State.AddService("magic", "user-admin", charm, nil, nil) |
121 | s.addUnit(c, magic) |
122 | s.addUnit(c, magic) |
123 | |
124 | - notAssigned, err := s.State.AddService("not-assigned", "user-admin", charm) |
125 | + notAssigned, err := s.State.AddService("not-assigned", "user-admin", charm, nil, nil) |
126 | c.Assert(err, gc.IsNil) |
127 | _, err = notAssigned.AddUnit() |
128 | c.Assert(err, gc.IsNil) |
129 | |
130 | - _, err = s.State.AddService("no-units", "user-admin", charm) |
131 | + _, err = s.State.AddService("no-units", "user-admin", charm, nil, nil) |
132 | c.Assert(err, gc.IsNil) |
133 | |
134 | for i, test := range []struct { |
135 | @@ -241,7 +241,7 @@ |
136 | s.addMachineWithAddress(c, "10.3.2.1") |
137 | |
138 | charm := s.AddTestingCharm(c, "dummy") |
139 | - magic, err := s.State.AddService("magic", "user-admin", charm) |
140 | + magic, err := s.State.AddService("magic", "user-admin", charm, nil, nil) |
141 | s.addUnit(c, magic) |
142 | s.addUnit(c, magic) |
143 | |
144 | |
145 | === modified file 'state/compat_test.go' |
146 | --- state/compat_test.go 2014-03-25 09:25:04 +0000 |
147 | +++ state/compat_test.go 2014-03-25 16:12:36 +0000 |
148 | @@ -72,7 +72,7 @@ |
149 | _, err := s.state.AddUser(AdminUser, "pass") |
150 | c.Assert(err, gc.IsNil) |
151 | charm := addCharm(c, s.state, "quantal", testing.Charms.Dir("mysql")) |
152 | - service, err := s.state.AddService("mysql", "user-admin", charm) |
153 | + service, err := s.state.AddService("mysql", "user-admin", charm, nil, nil) |
154 | c.Assert(err, gc.IsNil) |
155 | // In 1.17.7+ all services have associated document in the |
156 | // networks collection. We remove it here to test backwards |
157 | |
158 | === modified file 'state/conn_test.go' |
159 | --- state/conn_test.go 2014-03-17 06:05:54 +0000 |
160 | +++ state/conn_test.go 2014-03-25 16:12:36 +0000 |
161 | @@ -79,6 +79,10 @@ |
162 | return state.AddTestingService(c, s.State, name, ch) |
163 | } |
164 | |
165 | +func (s *ConnSuite) AddTestingServiceWithNetworks(c *gc.C, name string, ch *state.Charm, includeNetworks, excludeNetworks []string) *state.Service { |
166 | + return state.AddTestingServiceWithNetworks(c, s.State, name, ch, includeNetworks, excludeNetworks) |
167 | +} |
168 | + |
169 | func (s *ConnSuite) AddSeriesCharm(c *gc.C, name, series string) *state.Charm { |
170 | return state.AddCustomCharm(c, s.State, name, "", "", series, -1) |
171 | } |
172 | |
173 | === modified file 'state/export_test.go' |
174 | --- state/export_test.go 2014-03-19 23:07:33 +0000 |
175 | +++ state/export_test.go 2014-03-25 16:12:36 +0000 |
176 | @@ -142,7 +142,11 @@ |
177 | } |
178 | |
179 | func AddTestingService(c *gc.C, st *State, name string, ch *Charm) *Service { |
180 | - service, err := st.AddService(name, "user-admin", ch) |
181 | + return AddTestingServiceWithNetworks(c, st, name, ch, nil, nil) |
182 | +} |
183 | + |
184 | +func AddTestingServiceWithNetworks(c *gc.C, st *State, name string, ch *Charm, includeNetworks, excludeNetworks []string) *Service { |
185 | + service, err := st.AddService(name, "user-admin", ch, includeNetworks, excludeNetworks) |
186 | c.Assert(err, gc.IsNil) |
187 | return service |
188 | } |
189 | |
190 | === modified file 'state/service_test.go' |
191 | --- state/service_test.go 2014-03-25 09:15:00 +0000 |
192 | +++ state/service_test.go 2014-03-25 16:12:36 +0000 |
193 | @@ -1438,3 +1438,13 @@ |
194 | c.Check(include, gc.HasLen, 0) |
195 | c.Check(exclude, gc.HasLen, 0) |
196 | } |
197 | + |
198 | +func (s *ServiceSuite) TestNetworksOnService(c *gc.C) { |
199 | + includeNetworks := []string{"yes", "on"} |
200 | + excludeNetworks := []string{"no", "off"} |
201 | + service := s.AddTestingServiceWithNetworks(c, "withnets", s.charm, includeNetworks, excludeNetworks) |
202 | + haveIncludeNetworks, haveExcludeNetworks, err := service.Networks() |
203 | + c.Assert(err, gc.IsNil) |
204 | + c.Check(haveIncludeNetworks, gc.DeepEquals, includeNetworks) |
205 | + c.Check(haveExcludeNetworks, gc.DeepEquals, excludeNetworks) |
206 | +} |
207 | |
208 | === modified file 'state/state.go' |
209 | --- state/state.go 2014-03-24 10:22:17 +0000 |
210 | +++ state/state.go 2014-03-25 16:12:36 +0000 |
211 | @@ -907,7 +907,7 @@ |
212 | // AddService creates a new service, running the supplied charm, with the |
213 | // supplied name (which must be unique). If the charm defines peer relations, |
214 | // they will be created automatically. |
215 | -func (st *State) AddService(name, ownerTag string, ch *Charm) (service *Service, err error) { |
216 | +func (st *State) AddService(name, ownerTag string, ch *Charm, includeNetworks, excludeNetworks []string) (service *Service, err error) { |
217 | defer utils.ErrorContextf(&err, "cannot add service %q", name) |
218 | kind, ownerId, err := names.ParseTag(ownerTag, names.UserTagKind) |
219 | if err != nil || kind != names.UserTagKind { |
220 | @@ -951,7 +951,7 @@ |
221 | ops := []txn.Op{ |
222 | env.assertAliveOp(), |
223 | createConstraintsOp(st, svc.globalKey(), constraints.Value{}), |
224 | - createNetworksOp(st, svc.globalKey(), []string{}, []string{}), |
225 | + createNetworksOp(st, svc.globalKey(), includeNetworks, excludeNetworks), |
226 | createSettingsOp(st, svc.settingsKey(), nil), |
227 | { |
228 | C: st.users.Name, |
229 | |
230 | === modified file 'state/state_test.go' |
231 | --- state/state_test.go 2014-03-20 01:23:05 +0000 |
232 | +++ state/state_test.go 2014-03-25 16:12:36 +0000 |
233 | @@ -964,19 +964,19 @@ |
234 | |
235 | func (s *StateSuite) TestAddService(c *gc.C) { |
236 | charm := s.AddTestingCharm(c, "dummy") |
237 | - _, err := s.State.AddService("haha/borken", "user-admin", charm) |
238 | + _, err := s.State.AddService("haha/borken", "user-admin", charm, nil, nil) |
239 | c.Assert(err, gc.ErrorMatches, `cannot add service "haha/borken": invalid name`) |
240 | _, err = s.State.Service("haha/borken") |
241 | c.Assert(err, gc.ErrorMatches, `"haha/borken" is not a valid service name`) |
242 | |
243 | // set that a nil charm is handled correctly |
244 | - _, err = s.State.AddService("umadbro", "user-admin", nil) |
245 | + _, err = s.State.AddService("umadbro", "user-admin", nil, nil, nil) |
246 | c.Assert(err, gc.ErrorMatches, `cannot add service "umadbro": charm is nil`) |
247 | |
248 | - wordpress, err := s.State.AddService("wordpress", "user-admin", charm) |
249 | + wordpress, err := s.State.AddService("wordpress", "user-admin", charm, nil, nil) |
250 | c.Assert(err, gc.IsNil) |
251 | c.Assert(wordpress.Name(), gc.Equals, "wordpress") |
252 | - mysql, err := s.State.AddService("mysql", "user-admin", charm) |
253 | + mysql, err := s.State.AddService("mysql", "user-admin", charm, nil, nil) |
254 | c.Assert(err, gc.IsNil) |
255 | c.Assert(mysql.Name(), gc.Equals, "mysql") |
256 | |
257 | @@ -1003,7 +1003,7 @@ |
258 | c.Assert(err, gc.IsNil) |
259 | err = env.Destroy() |
260 | c.Assert(err, gc.IsNil) |
261 | - _, err = s.State.AddService("s1", "user-admin", charm) |
262 | + _, err = s.State.AddService("s1", "user-admin", charm, nil, nil) |
263 | c.Assert(err, gc.ErrorMatches, `cannot add service "s1": environment is no longer alive`) |
264 | } |
265 | |
266 | @@ -1018,7 +1018,7 @@ |
267 | c.Assert(env.Life(), gc.Equals, state.Alive) |
268 | c.Assert(env.Destroy(), gc.IsNil) |
269 | }).Check() |
270 | - _, err = s.State.AddService("s1", "user-admin", charm) |
271 | + _, err = s.State.AddService("s1", "user-admin", charm, nil, nil) |
272 | c.Assert(err, gc.ErrorMatches, `cannot add service "s1": environment is no longer alive`) |
273 | } |
274 | |
275 | @@ -1030,19 +1030,19 @@ |
276 | |
277 | func (s *StateSuite) TestAddServiceNoTag(c *gc.C) { |
278 | charm := s.AddTestingCharm(c, "dummy") |
279 | - _, err := s.State.AddService("wordpress", state.AdminUser, charm) |
280 | + _, err := s.State.AddService("wordpress", state.AdminUser, charm, nil, nil) |
281 | c.Assert(err, gc.ErrorMatches, "cannot add service \"wordpress\": Invalid ownertag admin") |
282 | } |
283 | |
284 | func (s *StateSuite) TestAddServiceNotUserTag(c *gc.C) { |
285 | charm := s.AddTestingCharm(c, "dummy") |
286 | - _, err := s.State.AddService("wordpress", "machine-3", charm) |
287 | + _, err := s.State.AddService("wordpress", "machine-3", charm, nil, nil) |
288 | c.Assert(err, gc.ErrorMatches, "cannot add service \"wordpress\": Invalid ownertag machine-3") |
289 | } |
290 | |
291 | func (s *StateSuite) TestAddServiceNonExistentUser(c *gc.C) { |
292 | charm := s.AddTestingCharm(c, "dummy") |
293 | - _, err := s.State.AddService("wordpress", "user-notAuser", charm) |
294 | + _, err := s.State.AddService("wordpress", "user-notAuser", charm, nil, nil) |
295 | c.Assert(err, gc.ErrorMatches, "cannot add service \"wordpress\": user notAuser doesn't exist") |
296 | } |
297 | |
298 | @@ -1053,13 +1053,13 @@ |
299 | c.Assert(len(services), gc.Equals, 0) |
300 | |
301 | // Check that after adding services the result is ok. |
302 | - _, err = s.State.AddService("wordpress", "user-admin", charm) |
303 | + _, err = s.State.AddService("wordpress", "user-admin", charm, nil, nil) |
304 | c.Assert(err, gc.IsNil) |
305 | services, err = s.State.AllServices() |
306 | c.Assert(err, gc.IsNil) |
307 | c.Assert(len(services), gc.Equals, 1) |
308 | |
309 | - _, err = s.State.AddService("mysql", "user-admin", charm) |
310 | + _, err = s.State.AddService("mysql", "user-admin", charm, nil, nil) |
311 | c.Assert(err, gc.IsNil) |
312 | services, err = s.State.AllServices() |
313 | c.Assert(err, gc.IsNil) |
314 | @@ -2524,7 +2524,7 @@ |
315 | // Add a service and 4 units: one with a different version, one |
316 | // with an empty version, one with the current version, and one |
317 | // with the new version. |
318 | - service, err := s.State.AddService("wordpress", "user-admin", s.AddTestingCharm(c, "wordpress")) |
319 | + service, err := s.State.AddService("wordpress", "user-admin", s.AddTestingCharm(c, "wordpress"), nil, nil) |
320 | c.Assert(err, gc.IsNil) |
321 | unit0, err := service.AddUnit() |
322 | c.Assert(err, gc.IsNil) |
323 | @@ -2574,7 +2574,7 @@ |
324 | // Add a machine and a unit with the current version. |
325 | machine, err := s.State.AddMachine("series", state.JobHostUnits) |
326 | c.Assert(err, gc.IsNil) |
327 | - service, err := s.State.AddService("wordpress", "user-admin", s.AddTestingCharm(c, "wordpress")) |
328 | + service, err := s.State.AddService("wordpress", "user-admin", s.AddTestingCharm(c, "wordpress"), nil, nil) |
329 | c.Assert(err, gc.IsNil) |
330 | unit, err := service.AddUnit() |
331 | c.Assert(err, gc.IsNil) |
Reviewers: mp+212635_ code.launchpad. net,
Message:
Please take a look.
Description:
Add networks params to AddService
Append includeNetworks and excludeNetworks to AddService ceWithNetworks created in a couple of
function parameters, and updates callers appropriately.
New AddTestingServi
places and used for basic test.
https:/ /code.launchpad .net/~gz/ juju-core/ addservice_ using_networks/ +merge/ 212635
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/79800043/
Affected files (+59, -34 lines): status_ test.go jujutest/ livetests. go conn.go /charmrevisionu pdater/ testing/ suite.go /client/ run_test. go test.go test.go
A [revision details]
M cmd/juju/
M environs/
M juju/conn_test.go
M juju/deploy.go
M juju/testing/
M state/apiserver
M state/apiserver
M state/conn_test.go
M state/export_
M state/service_
M state/state.go
M state/state_test.go
Index: [revision details] 20140324132340- bdfed5wwtmq8ws9 7
=== 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: juju/conn_test.go Charms. ClonedURL( s.repo. Path, "quantal", "riak") PutCharm( curl, s.repo, false) State.AddServic e("testriak" , "user-admin", sch) State.AddServic e("testriak" , "user-admin", sch, s.conn. State, svc, 2, "")
=== modified file 'juju/conn_test.go'
--- juju/conn_test.go 2014-03-17 22:42:51 +0000
+++ juju/conn_test.go 2014-03-25 14:51:19 +0000
@@ -400,7 +400,7 @@
curl := coretesting.
sch, err := s.conn.
c.Assert(err, gc.IsNil)
- svc, err := s.conn.
+ svc, err := s.conn.
[]string{}, []string{})
c.Assert(err, gc.IsNil)
units, err := juju.AddUnits(
c.Assert(err, gc.IsNil)
Index: juju/deploy.go ds?). args.ServiceNam e, "user-admin", args.Charm) args.ServiceNam e, "user-admin", args.Charm,
=== modified file 'juju/deploy.go'
--- juju/deploy.go 2013-12-19 21:17:26 +0000
+++ juju/deploy.go 2014-03-25 14:51:19 +0000
@@ -49,7 +49,8 @@
}
// TODO(fwereade): transactional State.AddService including settings,
constraints
// (minimumUnitCount, initialMachineI
- service, err := st.AddService(
+ // TODO(gz): pass through real includeNetworks and excludeNetworks vals
+ service, err := st.AddService(
[]string{}, []string{})
if err != nil {
return nil, err
}
Index: state/service_ test.go service_ test.go' test.go 2014-03-18 15:51:17 +0000 test.go 2014-03-25 14:51:19 +0000 Service( s.mysql. Name()) includedNetwork s, gc.DeepEquals, []string{}) excludedNetwork s, gc.DeepEquals, []string{}) includeNetworks , gc.DeepEquals, []string{}) excludeNetworks , gc.DeepEquals, []string{})
=== modified file 'state/
--- state/service_
+++ state/service_
@@ -1433,8 +1433,18 @@
func (s *ServiceSuite) TestNetworks(c *gc.C) {
service, err := s.State.
c.Assert(err, gc.IsNil)
- includedNetworks, excludedNetworks, err := service.Networks()
- c.Assert(err, gc.IsNil)
- c.Check(
- c.Check(
+ includeNetworks, excludeNetworks, err := service.Networks()
+ c.Assert(err, gc.IsNil)
+ c.Check(
+ c.Check(
+}
+
+func (s *ServiceSuite) Te...