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

Issue 7811045: cmd/jujud: bootstrap-state accepts --constraints

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years, 9 months ago by fwereade
Modified:
12 years, 9 months ago
Reviewers:
dimitern, mp+153523, jameinel
Visibility:
Public.

Description

cmd/jujud: bootstrap-state accepts --constraints ...and sets them on the environment. This feature currently has no clients. https://code.launchpad.net/~fwereade/juju-core/bootstrap-constraints-1/+merge/153523 (do not edit description out of merge proposal)

Patch Set 1 #

Total comments: 6

Patch Set 2 : cmd/jujud: bootstrap-state accepts --constraints #

Unified diffs Side-by-side diffs Delta from patch set Stats (+79 lines, -35 lines) Patch
A [revision details] View 1 1 chunk +2 lines, -0 lines 0 comments Download
M cmd/jujud/bootstrap.go View 1 3 chunks +10 lines, -4 lines 0 comments Download
M cmd/jujud/bootstrap_test.go View 4 chunks +38 lines, -31 lines 0 comments Download
M state/constraints.go View 1 chunk +18 lines, -0 lines 0 comments Download
M state/constraints_test.go View 1 chunk +11 lines, -0 lines 0 comments Download

Messages

Total messages: 5
fwereade
Please take a look.
12 years, 9 months ago (2013-03-15 10:14:19 UTC) #1
dimitern
LGTM with a trivial suggestion. https://codereview.appspot.com/7811045/diff/1/cmd/jujud/bootstrap.go File cmd/jujud/bootstrap.go (right): https://codereview.appspot.com/7811045/diff/1/cmd/jujud/bootstrap.go#newcode77 cmd/jujud/bootstrap.go:77: if err != nil ...
12 years, 9 months ago (2013-03-15 13:11:38 UTC) #2
jameinel
LGTM https://codereview.appspot.com/7811045/diff/1/cmd/jujud/bootstrap.go File cmd/jujud/bootstrap.go (right): https://codereview.appspot.com/7811045/diff/1/cmd/jujud/bootstrap.go#newcode77 cmd/jujud/bootstrap.go:77: if err != nil { On 2013/03/15 13:11:38, ...
12 years, 9 months ago (2013-03-18 17:52:41 UTC) #3
jameinel
LGTM
12 years, 9 months ago (2013-03-18 17:52:42 UTC) #4
fwereade
12 years, 9 months ago (2013-03-18 22:36:31 UTC) #5
*** Submitted:

cmd/jujud: bootstrap-state accepts --constraints

...and sets them on the environment. This feature currently has no clients.

R=dimitern, jameinel
CC=
https://codereview.appspot.com/7811045

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

https://codereview.appspot.com/7811045/diff/1/cmd/jujud/bootstrap.go#newcode77
cmd/jujud/bootstrap.go:77: if err != nil {
On 2013/03/18 17:52:41, jameinel wrote:
> On 2013/03/15 13:11:38, dimitern wrote:
> > merge lines (if/err=) ?
> 
> That doesn't seem to be the pattern in this file, though I've certainly seen
> that used elsewhere in the code.

Heh, there doesn't seem to be much pattern anyway, may as well impose some.
Done.

https://codereview.appspot.com/7811045/diff/1/cmd/jujud/bootstrap_test.go
File cmd/jujud/bootstrap_test.go (right):

https://codereview.appspot.com/7811045/diff/1/cmd/jujud/bootstrap_test.go#new...
cmd/jujud/bootstrap_test.go:85: tcons := state.Constraints{Mem: uint64p(2048),
CpuCores: uint64p(2)}
On 2013/03/18 17:52:41, jameinel wrote:
> I'm curious why this takes pointers instead of just uint64 items. But the
helper
> is certainly nice for this.

For combination later: a zero value is an explicit "anything goes", while a nil
value abdicates choice and falls back (for that value) from service constraints
to environ constraints (and from there implicitly back to the provider
implementation, which is responsible for doing something sane in the face of
empty constraints).

This is related to one of the reasons that I pass around a Constraints not a
*Constraints: that a zero Constraints is a meaningful thing (that explicitly
falls back in every case), while a *Constraints adds another layer of
zeroability that can IMO only obscure clarity. It is also, indeed, convenient to
modify them in place and it is nice that always passing them by value enables
slightly cleaner code in a couple of places.

Fwiw, subsequent branches have led me to believe that I should be exclusively
specifying test constraints with strings, and add a MustParse func for that
purpose, but I know roger's moving constraints into its own package so I'd
rather not muddy that right now.
Sign in to reply to this message.

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