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

Issue 75990043: Dump cloud-init-output.log on failed bootstrap

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years, 1 month ago by axw
Modified:
10 years, 1 month ago
Reviewers:
mp+211016, rog
Visibility:
Public.

Description

Dump cloud-init-output.log on failed bootstrap Currently if bootstrap (or manual provisioning) fails, we don't get a useful error message, just "exit status 1" (because the SSH script failed). This change is to dump the contents of the cloud-init-output.log file to stderr when the SSH script fails. Fixes lp:1279710 https://code.launchpad.net/~axwalk/juju-core/lp1279710-cloudinitoutput-on-error/+merge/211016 (do not edit description out of merge proposal)

Patch Set 1 #

Total comments: 6

Patch Set 2 : Dump cloud-init-output.log on failed bootstrap #

Unified diffs Side-by-side diffs Delta from patch set Stats (+181 lines, -29 lines) Patch
A [revision details] View 1 1 chunk +2 lines, -0 lines 0 comments Download
M environs/manual/provisioner.go View 1 6 chunks +20 lines, -7 lines 0 comments Download
M environs/manual/provisioner_test.go View 1 3 chunks +32 lines, -0 lines 0 comments Download
M provider/common/bootstrap.go View 1 2 chunks +7 lines, -1 line 0 comments Download
M provider/local/environ.go View 1 2 chunks +3 lines, -1 line 0 comments Download
M state/apiserver/client/client.go View 2 chunks +2 lines, -12 lines 0 comments Download
M state/apiserver/client/client_test.go View 2 chunks +2 lines, -8 lines 0 comments Download
A utils/shell/package_test.go View 1 1 chunk +14 lines, -0 lines 0 comments Download
A utils/shell/script.go View 1 1 chunk +28 lines, -0 lines 0 comments Download
A utils/shell/script_test.go View 1 1 chunk +71 lines, -0 lines 0 comments Download

Messages

Total messages: 4
axw
Please take a look.
10 years, 1 month ago (2014-03-14 10:34:26 UTC) #1
rog
LGTM assuming you've tested it live, with a few superficial suggestions below. https://codereview.appspot.com/75990043/diff/1/environs/cloudinit/cloudinit.go File environs/cloudinit/cloudinit.go ...
10 years, 1 month ago (2014-03-14 12:11:38 UTC) #2
axw
Please take a look. https://codereview.appspot.com/75990043/diff/1/environs/cloudinit/cloudinit.go File environs/cloudinit/cloudinit.go (right): https://codereview.appspot.com/75990043/diff/1/environs/cloudinit/cloudinit.go#newcode409 environs/cloudinit/cloudinit.go:409: func DumpLogOnError(mcfg *MachineConfig) string { ...
10 years, 1 month ago (2014-03-17 03:21:31 UTC) #3
rog
10 years, 1 month ago (2014-03-17 08:22:38 UTC) #4
On 2014/03/17 03:21:31, axw wrote:
> Please take a look.
> 
> https://codereview.appspot.com/75990043/diff/1/environs/cloudinit/cloudinit.go
> File environs/cloudinit/cloudinit.go (right):
> 
>
https://codereview.appspot.com/75990043/diff/1/environs/cloudinit/cloudinit.g...
> environs/cloudinit/cloudinit.go:409: func DumpLogOnError(mcfg *MachineConfig)
> string {
> On 2014/03/14 12:11:39, rog wrote:
> > This isn't really that deeply connected to MachineConfig,
> > or environs, and it's perhaps reasonable for the callers to know about
> > the cloudinit file, so perhaps this might be better in
> > utils, say, as:
> > 
> > // DumpFileOnErrorScript returns a script that
> > // prints the contents of the given file to
> > // standard error if any commands following it exit with an error.
> > // The returned script is newline terminated.
> > func DumpFileOnErrorScript(filename string) string
> > 
> > then the callers can use
utils.DumpFileOnErrorScript(mcfg.CloudInitOutputLog)
> 
> Done, though I'm starting a new package: utils/shell. We can move ShQuote and
> other shell related things in there over time.
> 
>
https://codereview.appspot.com/75990043/diff/1/environs/cloudinit/cloudinit.g...
> environs/cloudinit/cloudinit.go:418: trap "dump_cloudinit_log" EXIT
> On 2014/03/14 12:11:39, rog wrote:
> > i didn't know that EXIT works rather than 0, but as both dash and bash seem
to
> > support it, i guess it's ok.
> > 
> > The quotes are unnecessary here BTW.
> 
> Thanks, removed
> 
> https://codereview.appspot.com/75990043/diff/1/environs/manual/provisioner.go
> File environs/manual/provisioner.go (right):
> 
>
https://codereview.appspot.com/75990043/diff/1/environs/manual/provisioner.go...
> environs/manual/provisioner.go:319: script = fmt.Sprintf("rm -f %s\n",
> utils.ShQuote(mcfg.CloudInitOutputLog)) + script
> On 2014/03/14 12:11:39, rog wrote:
> > rather than doing thing backwards, i'd be tempted to build the script up in
> > order:
> > 
> > var buf bytes.Buffer
> > // Always remove the cloud-init-output.log file first, if it exists.
> > fmt.Fprintf(&buf, "rm -f %s\n", ...)
> > buf.WriteString(cloudinit.DumpLogOnError(mcfg))
> > configScript, err := sshinit.ConfigureScript(cloudcfg)
> > ...
> > buf.WriteString(configScript)
> > return buf.String(), nil
> 
> Done.

LGTM
Sign in to reply to this message.

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