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

Issue 38240043: Introduce BootstrapContext

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

Description

Introduce BootstrapContext Environ.Bootstrap now takes an additional parameter, a *BootstrapContext. This is a structure that permits access to the caller's context. It currently comprises stdio handles and a signal handler. Fixes #1237736 https://code.launchpad.net/~axwalk/juju-core/lp1237736-bootstrap-context/+merge/197999 (do not edit description out of merge proposal)

Patch Set 1 #

Total comments: 7

Patch Set 2 : Introduce BootstrapContext #

Total comments: 6

Patch Set 3 : Introduce BootstrapContext #

Patch Set 4 : Introduce BootstrapContext #

Total comments: 10

Patch Set 5 : Introduce BootstrapContext #

Unified diffs Side-by-side diffs Delta from patch set Stats (+394 lines, -246 lines) Patch
A [revision details] View 1 2 3 4 1 chunk +2 lines, -0 lines 0 comments Download
M cloudinit/sshinit/configure.go View 1 2 3 2 chunks +26 lines, -8 lines 0 comments Download
M cmd/cmd.go View 1 2 3 2 chunks +11 lines, -0 lines 0 comments Download
M cmd/juju/addmachine.go View 1 2 3 1 chunk +4 lines, -1 line 0 comments Download
M cmd/juju/bootstrap.go View 1 2 4 chunks +20 lines, -2 lines 0 comments Download
M environs/bootstrap/bootstrap.go View 1 2 2 chunks +2 lines, -2 lines 0 comments Download
M environs/bootstrap/bootstrap_test.go View 1 2 3 4 7 chunks +14 lines, -9 lines 0 comments Download
M environs/interface.go View 1 2 3 4 4 chunks +26 lines, -2 lines 0 comments Download
M environs/jujutest/livetests.go View 1 2 3 4 2 chunks +2 lines, -2 lines 0 comments Download
M environs/jujutest/tests.go View 1 2 3 4 3 chunks +6 lines, -2 lines 0 comments Download
M environs/manual/bootstrap.go View 1 2 2 chunks +2 lines, -1 line 0 comments Download
M environs/manual/bootstrap_test.go View 1 2 3 4 2 chunks +3 lines, -0 lines 0 comments Download
M environs/manual/provisioner.go View 1 2 3 5 chunks +20 lines, -3 lines 0 comments Download
M environs/open_test.go View 1 2 3 4 1 chunk +3 lines, -1 line 0 comments Download
M environs/sshstorage/storage.go View 1 5 chunks +37 lines, -21 lines 0 comments Download
M environs/sshstorage/storage_test.go View 10 chunks +25 lines, -14 lines 0 comments Download
M environs/testing/bootstrap.go View 1 2 3 4 2 chunks +25 lines, -1 line 0 comments Download
M juju/apiconn_test.go View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M juju/conn_test.go View 1 2 3 4 6 chunks +10 lines, -6 lines 0 comments Download
M juju/testing/conn.go View 1 2 3 4 1 chunk +2 lines, -1 line 0 comments Download
M provider/azure/environ.go View 1 2 2 chunks +2 lines, -2 lines 0 comments Download
M provider/common/bootstrap.go View 1 2 3 4 10 chunks +40 lines, -79 lines 0 comments Download
M provider/common/bootstrap_test.go View 1 2 3 4 10 chunks +54 lines, -56 lines 0 comments Download
M provider/dummy/environs.go View 1 2 3 3 chunks +3 lines, -2 lines 0 comments Download
M provider/ec2/ec2.go View 1 2 3 1 chunk +2 lines, -2 lines 0 comments Download
M provider/ec2/local_test.go View 1 2 3 4 5 chunks +8 lines, -4 lines 0 comments Download
M provider/joyent/environ.go View 1 2 1 chunk +2 lines, -2 lines 0 comments Download
M provider/local/environ.go View 1 2 1 chunk +1 line, -1 line 0 comments Download
M provider/maas/environ.go View 1 2 3 1 chunk +2 lines, -2 lines 0 comments Download
M provider/maas/environ_whitebox_test.go View 1 2 3 4 5 chunks +10 lines, -5 lines 0 comments Download
M provider/null/environ.go View 1 2 3 4 chunks +11 lines, -3 lines 0 comments Download
M provider/null/environ_test.go View 1 2 3 4 2 chunks +6 lines, -3 lines 0 comments Download
M provider/openstack/local_test.go View 1 2 3 4 7 chunks +10 lines, -6 lines 0 comments Download
M provider/openstack/provider.go View 1 2 3 2 chunks +2 lines, -2 lines 0 comments Download

Messages

Total messages: 10
axw
Please take a look.
10 years, 5 months ago (2013-12-06 07:33:28 UTC) #1
fwereade
Looks generally clean, but I'd like rog's input on the interrupt handling. https://codereview.appspot.com/38240043/diff/1/cloudinit/sshinit/configure.go File cloudinit/sshinit/configure.go ...
10 years, 5 months ago (2013-12-11 08:36:46 UTC) #2
axw
Please take a look. https://codereview.appspot.com/38240043/diff/1/cloudinit/sshinit/configure.go File cloudinit/sshinit/configure.go (right): https://codereview.appspot.com/38240043/diff/1/cloudinit/sshinit/configure.go#newcode26 cloudinit/sshinit/configure.go:26: Config *cloudinit.Config On 2013/12/11 08:36:46, ...
10 years, 5 months ago (2013-12-11 09:37:13 UTC) #3
rog
Looks reasonable in general, but some concerns outlined below. https://codereview.appspot.com/38240043/diff/20001/environs/bootstrapcontext.go File environs/bootstrapcontext.go (right): https://codereview.appspot.com/38240043/diff/20001/environs/bootstrapcontext.go#newcode49 environs/bootstrapcontext.go:49: ...
10 years, 4 months ago (2013-12-11 18:53:23 UTC) #4
axw
Please take a look. https://codereview.appspot.com/38240043/diff/20001/environs/bootstrapcontext.go File environs/bootstrapcontext.go (right): https://codereview.appspot.com/38240043/diff/20001/environs/bootstrapcontext.go#newcode49 environs/bootstrapcontext.go:49: func (ctx *BootstrapContext) SetInterruptHandler(f func()) ...
10 years, 4 months ago (2013-12-19 08:44:33 UTC) #5
axw
On 2013/12/19 08:44:33, axw wrote: > Please take a look. > > https://codereview.appspot.com/38240043/diff/20001/environs/bootstrapcontext.go > File ...
10 years, 4 months ago (2013-12-19 09:14:53 UTC) #6
axw
Please take a look.
10 years, 4 months ago (2013-12-19 09:29:25 UTC) #7
rog
LGTM, thanks, with a few thoughts below. Also, with respect to this: > I don't ...
10 years, 4 months ago (2013-12-19 11:29:57 UTC) #8
axw
On 2013/12/19 11:29:57, rog wrote: > LGTM, thanks, with a few thoughts below. > > ...
10 years, 4 months ago (2013-12-20 02:09:04 UTC) #9
axw
10 years, 4 months ago (2013-12-20 02:42:08 UTC) #10
Please take a look.

https://codereview.appspot.com/38240043/diff/60001/environs/interface.go
File environs/interface.go (right):

https://codereview.appspot.com/38240043/diff/60001/environs/interface.go#newc...
environs/interface.go:200: // Environ.Bootstrap, providing it a means of
obtaining
On 2013/12/19 11:29:57, rog wrote:
> s/it // ?

I meant provided to Environ.Bootstrap. It makes sense either way to me; I'm not
fussed, I'll change it.

https://codereview.appspot.com/38240043/diff/60001/environs/testing/bootstrap.go
File environs/testing/bootstrap.go (right):

https://codereview.appspot.com/38240043/diff/60001/environs/testing/bootstrap...
environs/testing/bootstrap.go:50: func NewBootstrapContext(c *gc.C)
BootstrapContext {
On 2013/12/19 11:29:57, rog wrote:
> Wouldn't it be better if this returned environs.BootstrapContext ?
> (the local type could be unexported)

I had planned to do that, but some tests want to change the stdio objects.
Alternatively, NewBootstrapContext could just take a *cmd.Context. I'll do that
before landing.

https://codereview.appspot.com/38240043/diff/60001/provider/common/bootstrap.go
File provider/common/bootstrap.go (right):

https://codereview.appspot.com/38240043/diff/60001/provider/common/bootstrap....
provider/common/bootstrap.go:91: for {
On 2013/12/19 11:29:57, rog wrote:
> for _ = range ch {
>      fmt.Fprintln(ctx.Stderr(), "Cleaning up failed bootstrap")
> }
> return
> ?

Wow, that was dumb. Thanks.

> I wonder if we should allow the user to abort if they interrupt more than 3
> times...

Sounds reasonable, but I'd like to stick with what we've got for now and tweak
it based on feedback after it's been used a bit.

https://codereview.appspot.com/38240043/diff/60001/provider/common/bootstrap....
provider/common/bootstrap.go:154: // the terminal, which will be the ssh
subprocess at this
On 2013/12/19 11:29:57, rog wrote:
> For the record, I don't believe this is actually true.
> The interrupt gets sent to all processes in the foreground
> process group of the terminal.

My statement wasn't meant imply that it was exclusive of all other processes in
the group. That's why the signal remains blocked; so that when it gets delivered
to the child and this one, this one ignores it and simply waits on the child's
death.

If I'm still wrong, I'd be happy for some schooling :)
Sign in to reply to this message.

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