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

Issue 8352043: bootstrap: add --fake-series

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 1 month ago by fwereade
Modified:
11 years, 1 month ago
Reviewers:
dimitern, mp+156997, thumper
Visibility:
Public.

Description

bootstrap: add --fake-series This allows developers to distribute multiple copies of their locally-built tools to their private bucket, varying only by claimed series. So long as the tools are in fact compatible across series, this allows us to run/test mixed-series environments by specifying up-front what series we plan to use. This does not address the need for similar changes to upgrade-juju: the logic in there scares me a little, and it doesn't *need* to be fixed in this CL. To make --fake-series parsing consistent, I exported ValidSeries from the charm package; and then to make that package consistent, I exported both ValidUser and ValidName as well, and wrote some simple tests for them. https://code.launchpad.net/~fwereade/juju-core/bootstrap-fake-series/+merge/156997 (do not edit description out of merge proposal)

Patch Set 1 #

Total comments: 18

Patch Set 2 : bootstrap: add --fake-series #

Unified diffs Side-by-side diffs Delta from patch set Stats (+222 lines, -75 lines) Patch
A [revision details] View 1 1 chunk +2 lines, -0 lines 0 comments Download
M charm/url.go View 1 5 chunks +14 lines, -7 lines 0 comments Download
M charm/url_test.go View 4 chunks +56 lines, -2 lines 0 comments Download
M cmd/juju/bootstrap.go View 4 chunks +44 lines, -4 lines 0 comments Download
M cmd/juju/bootstrap_test.go View 2 chunks +37 lines, -1 line 0 comments Download
M cmd/juju/upgradejuju_test.go View 1 3 chunks +6 lines, -2 lines 0 comments Download
M environs/ec2/local_test.go View 1 1 chunk +1 line, -1 line 0 comments Download
M environs/jujutest/livetests.go View 1 1 chunk +1 line, -1 line 0 comments Download
M environs/tools.go View 1 4 chunks +32 lines, -37 lines 0 comments Download
M environs/tools_test.go View 1 3 chunks +29 lines, -20 lines 0 comments Download

Messages

Total messages: 5
fwereade
Please take a look.
11 years, 1 month ago (2013-04-03 23:40:17 UTC) #1
thumper
LGTM - just few comments and questions below. https://codereview.appspot.com/8352043/diff/1/charm/url.go File charm/url.go (right): https://codereview.appspot.com/8352043/diff/1/charm/url.go#newcode34 charm/url.go:34: var ...
11 years, 1 month ago (2013-04-04 01:53:08 UTC) #2
dave_cheney.net
https://codereview.appspot.com/8352043/diff/1/charm/url.go File charm/url.go (right): https://codereview.appspot.com/8352043/diff/1/charm/url.go#newcode34 charm/url.go:34: var ValidUser = regexp.MustCompile("^[a-z0-9][a-zA-Z0-9+.-]+$") On 2013/04/04 01:53:08, thumper wrote: ...
11 years, 1 month ago (2013-04-04 07:36:37 UTC) #3
dimitern
LGTM modulo the trivials below. https://codereview.appspot.com/8352043/diff/1/charm/url.go File charm/url.go (right): https://codereview.appspot.com/8352043/diff/1/charm/url.go#newcode34 charm/url.go:34: var ValidUser = regexp.MustCompile("^[a-z0-9][a-zA-Z0-9+.-]+$") ...
11 years, 1 month ago (2013-04-04 08:56:38 UTC) #4
fwereade
11 years, 1 month ago (2013-04-04 13:46:59 UTC) #5
*** Submitted:

bootstrap: add --fake-series

This allows developers to distribute multiple copies of their locally-built
tools to their private bucket, varying only by claimed series. So long as
the tools are in fact compatible across series, this allows us to run/test
mixed-series environments by specifying up-front what series we plan to use.

This does not address the need for similar changes to upgrade-juju: the
logic in there scares me a little, and it doesn't *need* to be fixed in
this CL.

To make --fake-series parsing consistent, I exported ValidSeries from the
charm package; and then to make that package consistent, I exported both
ValidUser and ValidName as well, and wrote some simple tests for them.

R=thumper, dfc, dimitern
CC=
https://codereview.appspot.com/8352043

https://codereview.appspot.com/8352043/diff/1/charm/url.go
File charm/url.go (right):

https://codereview.appspot.com/8352043/diff/1/charm/url.go#newcode34
charm/url.go:34: var ValidUser = regexp.MustCompile("^[a-z0-9][a-zA-Z0-9+.-]+$")
On 2013/04/04 08:56:38, dimitern wrote:
> In addition to comments, maybe put all 3 in a single var block?

SGTM, thanks all.

https://codereview.appspot.com/8352043/diff/1/cmd/juju/bootstrap.go
File cmd/juju/bootstrap.go (right):

https://codereview.appspot.com/8352043/diff/1/cmd/juju/bootstrap.go#newcode19
cmd/juju/bootstrap.go:19: UploadTools bool
On 2013/04/04 01:53:08, thumper wrote:
> Is there a reason that Constraints, UploadTools and FakeSeries are exported?

History/consistency. If your flags/args all do predictable things to exported
fields, you can test command initialization exhaustively in terms of what gets
set, and then separately test what happens when you run hand-built commands.

We don't do this very often, necessarily, but I'm loath to drop the pattern --
one day I would like to put these things in a real package and give them clean
tests, and IMO it'll be easier to do so if we bear this in mind.

https://codereview.appspot.com/8352043/diff/1/cmd/juju/bootstrap.go#newcode34
cmd/juju/bootstrap.go:34: f.Var(seriesVar{&c.FakeSeries}, "fake-series", "clone
uploaded tools for supplied serieses")
On 2013/04/04 01:53:08, thumper wrote:
> I have to admit that the seriesVar bit made this all look a bit too magical.

I don't think this is magical... this is what you're meant to do to parse args
that aren't straight-up StringVar/IntVar/whatever.

> Why not just have a method turned a string into an array of strings?

Because it's absurd to have two separate copies of the same information in a
type, but making one useful and one not. IMO InitCommand should leave you with
an initialized command, holding only the data it actually needs... anything else
is an invitation to inconsistency.

https://codereview.appspot.com/8352043/diff/1/cmd/juju/upgradejuju_test.go
File cmd/juju/upgradejuju_test.go (right):

https://codereview.appspot.com/8352043/diff/1/cmd/juju/upgradejuju_test.go#ne...
cmd/juju/upgradejuju_test.go:173: c.Logf("\ntest %d: %s\n", i, test.about)
On 2013/04/04 08:56:38, dimitern wrote:
> On 2013/04/04 07:36:37, dfc wrote:
> > I don't think either of the \n's are needed.
> 
> +1, except probably one of them, in case you want to see the NL in the log
dump.

When you get a few failures scattered through acres of logspam, it's *really*
nice to be able to scan up and see a visually distinct marker that leads one
back to the actual test that failed. But I guess that only needs one new line
;p.

https://codereview.appspot.com/8352043/diff/1/environs/tools.go
File environs/tools.go (right):

https://codereview.appspot.com/8352043/diff/1/environs/tools.go#newcode113
environs/tools.go:113: log.Infof("environs: built tools %v (%dkB)",
toolsVersion, (size+512)/1024)
On 2013/04/04 08:56:38, dimitern wrote:
> what's the magic 512 here?

Half of 1024; ie, round to the nearest kB rather than down.

https://codereview.appspot.com/8352043/diff/1/environs/tools_test.go
File environs/tools_test.go (right):

https://codereview.appspot.com/8352043/diff/1/environs/tools_test.go#newcode142
environs/tools_test.go:142: 
On 2013/04/04 08:56:38, dimitern wrote:
> d

Done.
Sign in to reply to this message.

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