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

Issue 41660044: Implement the juju-run symlink in jujud

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years, 5 months ago by thumper
Modified:
10 years, 5 months ago
Reviewers:
wallyworld, mp+198865
Visibility:
Public.

Description

Implement the juju-run symlink in jujud Adds a command in the jujud executable so if the executable is called as juju-run, it will attempt to connect to the rpc server being run by the unit specified as the first arg. In order to get the return code passed out of the command infrastructure I added a new error type in the cmd package called "rcPassthroughError", which has a return code in it. We use the jujud from the machine agent as the target of the juju-run symlink as we can add the symlink using cloud-init and we know there is only one machine agent. https://code.launchpad.net/~thumper/juju-core/jujuc-run/+merge/198865 Requires: https://code.launchpad.net/~thumper/juju-core/uniter-run-commands/+merge/198830 (do not edit description out of merge proposal)

Patch Set 1 #

Total comments: 10

Patch Set 2 : Implement the juju-run symlink in jujud #

Unified diffs Side-by-side diffs Delta from patch set Stats (+280 lines, -0 lines) Patch
A [revision details] View 1 1 chunk +2 lines, -0 lines 0 comments Download
M cmd/cmd.go View 1 2 chunks +23 lines, -0 lines 0 comments Download
M cmd/jujud/main.go View 1 chunk +2 lines, -0 lines 0 comments Download
A cmd/jujud/run.go View 1 1 chunk +108 lines, -0 lines 0 comments Download
A cmd/jujud/run_test.go View 1 chunk +135 lines, -0 lines 0 comments Download
M environs/cloudinit/cloudinit.go View 1 1 chunk +8 lines, -0 lines 0 comments Download
M environs/cloudinit/cloudinit_test.go View 2 chunks +2 lines, -0 lines 0 comments Download

Messages

Total messages: 3
thumper
Please take a look.
10 years, 5 months ago (2013-12-13 03:57:30 UTC) #1
wallyworld
LGTM with some tweaks and a suggestion https://codereview.appspot.com/41660044/diff/1/cmd/cmd.go File cmd/cmd.go (right): https://codereview.appspot.com/41660044/diff/1/cmd/cmd.go#newcode20 cmd/cmd.go:20: type rcPassthroughError ...
10 years, 5 months ago (2013-12-13 04:17:33 UTC) #2
thumper
10 years, 5 months ago (2013-12-13 04:54:31 UTC) #3
Please take a look.

https://codereview.appspot.com/41660044/diff/1/cmd/cmd.go
File cmd/cmd.go (right):

https://codereview.appspot.com/41660044/diff/1/cmd/cmd.go#newcode20
cmd/cmd.go:20: type rcPassthroughError struct {
On 2013/12/13 04:17:33, wallyworld wrote:
> Why not use a type alias?

I think because I want a real struct here. A type alias to int is just weird.

https://codereview.appspot.com/41660044/diff/1/cmd/cmd.go#newcode33
cmd/cmd.go:33: func NewRcPassthroughError(code int) error {
On 2013/12/13 04:17:33, wallyworld wrote:
> Need doc here and/or the struct definition to say what it is for

Done.

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

https://codereview.appspot.com/41660044/diff/1/cmd/jujud/main.go#newcode118
cmd/jujud/main.go:118: code = cmd.Main(&RunCommand{}, cmd.DefaultContext(),
args[1:])
On 2013/12/13 04:17:33, wallyworld wrote:
> Should we follow the pattern used for jujuc and jujud and have a jujurunMain
> method?

We could, but it would just be one line... so I chose not to.

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

https://codereview.appspot.com/41660044/diff/1/cmd/jujud/run.go#newcode67
cmd/jujud/run.go:67: c.unit = names.UnitTag(c.unit)
On 2013/12/13 04:17:33, wallyworld wrote:
> can we have a comment here explaining what is being done ie unit can be either
a
> name or tag?

Done.

https://codereview.appspot.com/41660044/diff/1/environs/cloudinit/cloudinit.go
File environs/cloudinit/cloudinit.go (right):

https://codereview.appspot.com/41660044/diff/1/environs/cloudinit/cloudinit.g...
environs/cloudinit/cloudinit.go:242: fmt.Sprintf("ln -s %s/tools/%s/jujud
/usr/local/bin/juju-run", cfg.DataDir, machineTag),
On 2013/12/13 04:17:33, wallyworld wrote:
> please use cfg.jujuTools()

No, but comment added to explain why.
Sign in to reply to this message.

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