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

Issue 44240045: cmd/juju: deploy using the API + 1.16 compat. (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years, 4 months ago by dimitern
Modified:
10 years, 4 months ago
Reviewers:
mp+199655, rog
Visibility:
Public.

Description

cmd/juju: deploy using the API + 1.16 compat. juju deploy starts to use the API only, if possible. Older API servers, not supporting charm uploads are detected and the old 1.16-compatible code with a direct state connection is executed. In addition to that, bug #1216830 is fixed (no juju.Conn usage in state/apiserver antmore), which required some refactoring, namely moving conn.DeployService and also conn.AddUnits out of juju.Conn and into a juju/deploy.go, taking a *state.State as argument. https://code.launchpad.net/~dimitern/juju-core/227-cli-deploy-via-api/+merge/199655 Requires: https://code.launchpad.net/~dimitern/juju-core/226-addcharm-api/+merge/199478 (do not edit description out of merge proposal)

Patch Set 1 #

Total comments: 22

Patch Set 2 : cmd/juju: deploy using the API + 1.16 compat. #

Total comments: 10

Patch Set 3 : cmd/juju: deploy using the API + 1.16 compat. #

Total comments: 6

Patch Set 4 : cmd/juju: deploy using the API + 1.16 compat. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+457 lines, -283 lines) Patch
A [revision details] View 1 2 3 1 chunk +2 lines, -0 lines 0 comments Download
M cmd/juju/deploy.go View 1 2 3 6 chunks +130 lines, -10 lines 0 comments Download
M cmd/juju/deploy_test.go View 3 chunks +19 lines, -17 lines 0 comments Download
M cmd/jujud/machine_test.go View 1 2 3 chunks +3 lines, -2 lines 0 comments Download
M environs/jujutest/livetests.go View 1 2 1 chunk +1 line, -1 line 0 comments Download
M juju/conn.go View 1 2 3 chunks +0 lines, -131 lines 0 comments Download
M juju/conn_test.go View 1 2 10 chunks +64 lines, -56 lines 0 comments Download
A juju/deploy.go View 1 2 1 chunk +143 lines, -0 lines 0 comments Download
M juju/testing/repo.go View 1 chunk +6 lines, -0 lines 0 comments Download
M state/api/client.go View 2 chunks +7 lines, -9 lines 0 comments Download
M state/api/client_test.go View 1 chunk +1 line, -3 lines 0 comments Download
M state/apiserver/client/client.go View 1 2 3 5 chunks +36 lines, -38 lines 0 comments Download
M state/apiserver/client/client_test.go View 1 2 8 chunks +42 lines, -14 lines 0 comments Download
M state/apiserver/client/perm_test.go View 1 chunk +1 line, -1 line 0 comments Download
M worker/firewaller/firewaller_test.go View 1 2 2 chunks +2 lines, -1 line 0 comments Download

Messages

Total messages: 7
dimitern
Please take a look.
10 years, 4 months ago (2013-12-19 12:46:56 UTC) #1
rog
Looks OK in general, but some suggestions and comments below. https://codereview.appspot.com/44240045/diff/1/cmd/juju/deploy.go File cmd/juju/deploy.go (right): https://codereview.appspot.com/44240045/diff/1/cmd/juju/deploy.go#newcode141 ...
10 years, 4 months ago (2013-12-19 14:20:12 UTC) #2
dimitern
Please take a look. https://codereview.appspot.com/44240045/diff/1/cmd/juju/deploy.go File cmd/juju/deploy.go (right): https://codereview.appspot.com/44240045/diff/1/cmd/juju/deploy.go#newcode141 cmd/juju/deploy.go:141: attrs, err := client.EnvironmentGet() On ...
10 years, 4 months ago (2013-12-19 15:36:18 UTC) #3
rog
https://codereview.appspot.com/44240045/diff/1/cmd/juju/deploy.go File cmd/juju/deploy.go (right): https://codereview.appspot.com/44240045/diff/1/cmd/juju/deploy.go#newcode141 cmd/juju/deploy.go:141: attrs, err := client.EnvironmentGet() On 2013/12/19 15:36:19, dimitern wrote: ...
10 years, 4 months ago (2013-12-19 17:06:12 UTC) #4
dimitern
Please take a look. https://codereview.appspot.com/44240045/diff/20001/cmd/juju/deploy.go File cmd/juju/deploy.go (right): https://codereview.appspot.com/44240045/diff/20001/cmd/juju/deploy.go#newcode268 cmd/juju/deploy.go:268: latest, err := repo.Latest(curl) On ...
10 years, 4 months ago (2013-12-19 18:24:26 UTC) #5
rog
LGTM modulo the below. It'd be nice to fix lp#1216830 but I don't mind if ...
10 years, 4 months ago (2013-12-19 18:41:24 UTC) #6
dimitern
10 years, 4 months ago (2013-12-19 19:38:10 UTC) #7
Please take a look.

https://codereview.appspot.com/44240045/diff/20001/state/apiserver/client/cli...
File state/apiserver/client/client.go (right):

https://codereview.appspot.com/44240045/diff/20001/state/apiserver/client/cli...
state/apiserver/client/client.go:251: need1dot16Compatibility = true
On 2013/12/19 18:41:25, rog wrote:
> On 2013/12/19 18:24:26, dimitern wrote:
> > On 2013/12/19 17:06:12, rog wrote:
> > > I think we can be quite a bit simpler here:
> > > 
> > > if jujuerrors.IsNotFoundError(err) {
> > >      // Remove this code when 1.16 compatibility is dropped.
> > >      err := c.AddCharm(params.CharmURL{args.CharmURL}
> > >      if err != nil {
> > >          return err
> > >      }
> > > }
> > 
> > Done slightly differently (AddCharm supports only cs: charms, so we still
need
> > the check)
> 
> See comment on new code.
> 
> Bug 1216830 isn't fixed unless you change serviceSetCharm too, BTW.

You're correct, I'll reassign the bug to the follow-up, which fixes this.

https://codereview.appspot.com/44240045/diff/40001/state/apiserver/client/cli...
File state/apiserver/client/client.go (right):

https://codereview.appspot.com/44240045/diff/40001/state/apiserver/client/cli...
state/apiserver/client/client.go:228: // It assumes
On 2013/12/19 18:41:25, rog wrote:
> It assumes... ?
> 
> I guess you wanted to say something like:
> 
> // AddCharm or AddLocalCharm should be called to add the charm
> // before calling ServiceDeploy, although for backward compatibility
> // this is not necessary until 1.16 support is removed.

Done.

https://codereview.appspot.com/44240045/diff/40001/state/apiserver/client/cli...
state/apiserver/client/client.go:241: // Remove this while if block when 1.16
compatibility is dropped.
On 2013/12/19 18:41:25, rog wrote:
> s/while/whole/ ?

Done.

https://codereview.appspot.com/44240045/diff/40001/state/apiserver/client/cli...
state/apiserver/client/client.go:242: if curl.Schema != "cs" {
On 2013/12/19 18:41:25, rog wrote:
> Isn't this check replicated in AddCharm itself?

Not exactly with the same message, and I decided to keep this one for
compatibility.
Sign in to reply to this message.

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