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

Issue 94350045: Invert envcmd relationship

Can't Edit
Can't Publish+Mail
Start Review
Created:
9 years, 11 months ago by axw
Modified:
9 years, 11 months ago
Reviewers:
wallyworld, fwereade, mp+219135
Visibility:
Public.

Description

Invert envcmd relationship Previously we embedded EnvCommandBase in all commands requring an environment, and EnvCommandBase included everything (SetFlags, and Init). The problem with this is that it was easy to miss initialisation of the EnvCommandBase type (this happened a few times), which leads to bad things happening like sync-tools destroying environments. I have inverted the relationship so that we now have envcmd.EnvironCommand, an interface that extends Command with a SetEnvName method, and EnvCommandBase, which implements EnvironCommand. A new method, envcmd.Wrap takes an EnvironCommand and creates a Command that calls SetEnvName prior to the wrapped method's Init method. If the environment name cannot be determined, the wrapping command will error out early. https://code.launchpad.net/~axwalk/juju-core/envcmd-inversion/+merge/219135 (do not edit description out of merge proposal)

Patch Set 1 #

Total comments: 1

Patch Set 2 : Invert envcmd relationship #

Unified diffs Side-by-side diffs Delta from patch set Stats (+423 lines, -485 lines) Patch
A [revision details] View 1 1 chunk +2 lines, -0 lines 0 comments Download
M cmd/cmd.go View 1 chunk +12 lines, -9 lines 0 comments Download
M cmd/envcmd/environmentcommand.go View 2 chunks +77 lines, -37 lines 0 comments Download
M cmd/envcmd/environmentcommand_test.go View 4 chunks +42 lines, -18 lines 0 comments Download
M cmd/juju/addmachine.go View 2 chunks +1 line, -5 lines 0 comments Download
M cmd/juju/addmachine_test.go View 2 chunks +2 lines, -1 line 0 comments Download
M cmd/juju/addrelation.go View 1 chunk +0 lines, -3 lines 0 comments Download
M cmd/juju/addrelation_test.go View 2 chunks +2 lines, -1 line 0 comments Download
M cmd/juju/addunit.go View 1 chunk +0 lines, -4 lines 0 comments Download
M cmd/juju/addunit_test.go View 2 chunks +3 lines, -2 lines 0 comments Download
M cmd/juju/adduser.go View 1 chunk +0 lines, -3 lines 0 comments Download
M cmd/juju/adduser_test.go View 6 chunks +15 lines, -9 lines 0 comments Download
M cmd/juju/authorizedkeys.go View 1 2 chunks +5 lines, -4 lines 0 comments Download
M cmd/juju/authorizedkeys_add.go View 2 chunks +0 lines, -4 lines 0 comments Download
M cmd/juju/authorizedkeys_delete.go View 2 chunks +0 lines, -4 lines 0 comments Download
M cmd/juju/authorizedkeys_import.go View 2 chunks +0 lines, -4 lines 0 comments Download
M cmd/juju/authorizedkeys_list.go View 1 chunk +0 lines, -8 lines 0 comments Download
M cmd/juju/authorizedkeys_test.go View 11 chunks +11 lines, -10 lines 0 comments Download
M cmd/juju/bootstrap.go View 2 chunks +0 lines, -4 lines 0 comments Download
M cmd/juju/bootstrap_test.go View 14 chunks +15 lines, -14 lines 0 comments Download
M cmd/juju/cmd_test.go View 5 chunks +20 lines, -19 lines 0 comments Download
M cmd/juju/constraints.go View 3 chunks +0 lines, -8 lines 0 comments Download
M cmd/juju/constraints_test.go View 3 chunks +3 lines, -2 lines 0 comments Download
M cmd/juju/debuglog.go View 2 chunks +0 lines, -5 lines 0 comments Download
M cmd/juju/debuglog_test.go View 5 chunks +5 lines, -4 lines 0 comments Download
M cmd/juju/deploy.go View 2 chunks +0 lines, -4 lines 0 comments Download
M cmd/juju/deploy_test.go View 4 chunks +4 lines, -3 lines 0 comments Download
M cmd/juju/endpoint.go View 1 chunk +0 lines, -8 lines 0 comments Download
M cmd/juju/endpoint_test.go View 2 chunks +2 lines, -1 line 0 comments Download
M cmd/juju/ensureavailability.go View 1 chunk +0 lines, -4 lines 0 comments Download
M cmd/juju/ensureavailability_test.go View 2 chunks +2 lines, -1 line 0 comments Download
M cmd/juju/environment.go View 3 chunks +0 lines, -12 lines 0 comments Download
M cmd/juju/environment_test.go View 10 chunks +12 lines, -11 lines 0 comments Download
M cmd/juju/expose.go View 1 chunk +0 lines, -3 lines 0 comments Download
M cmd/juju/expose_test.go View 2 chunks +2 lines, -1 line 0 comments Download
M cmd/juju/get.go View 2 chunks +0 lines, -4 lines 0 comments Download
M cmd/juju/get_test.go View 2 chunks +2 lines, -1 line 0 comments Download
M cmd/juju/main.go View 1 2 chunks +67 lines, -71 lines 0 comments Download
M cmd/juju/main_test.go View 1 3 chunks +20 lines, -2 lines 0 comments Download
M cmd/juju/plugin.go View 2 chunks +2 lines, -9 lines 0 comments Download
M cmd/juju/publish.go View 1 chunk +0 lines, -4 lines 0 comments Download
M cmd/juju/publish_test.go View 8 chunks +8 lines, -7 lines 0 comments Download
M cmd/juju/removemachine.go View 1 chunk +0 lines, -4 lines 0 comments Download
M cmd/juju/removemachine_test.go View 2 chunks +2 lines, -1 line 0 comments Download
M cmd/juju/removerelation.go View 1 chunk +0 lines, -3 lines 0 comments Download
M cmd/juju/removerelation_test.go View 2 chunks +2 lines, -1 line 0 comments Download
M cmd/juju/removeservice.go View 1 chunk +0 lines, -3 lines 0 comments Download
M cmd/juju/removeservice_test.go View 2 chunks +2 lines, -1 line 0 comments Download
M cmd/juju/removeunit.go View 1 chunk +0 lines, -3 lines 0 comments Download
M cmd/juju/removeunit_test.go View 2 chunks +2 lines, -1 line 0 comments Download
M cmd/juju/removeuser.go View 1 chunk +0 lines, -3 lines 0 comments Download
M cmd/juju/removeuser_test.go View 2 chunks +5 lines, -4 lines 0 comments Download
M cmd/juju/resolved.go View 1 chunk +0 lines, -4 lines 0 comments Download
M cmd/juju/resolved_test.go View 2 chunks +2 lines, -1 line 0 comments Download
M cmd/juju/retryprovisioning.go View 1 chunk +0 lines, -3 lines 0 comments Download
M cmd/juju/retryprovisioning_test.go View 2 chunks +2 lines, -1 line 0 comments Download
M cmd/juju/run.go View 2 chunks +0 lines, -4 lines 0 comments Download
M cmd/juju/run_test.go View 5 chunks +5 lines, -4 lines 0 comments Download
M cmd/juju/set.go View 1 chunk +0 lines, -4 lines 0 comments Download
M cmd/juju/set_test.go View 3 chunks +3 lines, -2 lines 0 comments Download
M cmd/juju/ssh.go View 2 chunks +0 lines, -4 lines 0 comments Download
M cmd/juju/ssh_test.go View 2 chunks +2 lines, -1 line 0 comments Download
M cmd/juju/status.go View 2 chunks +0 lines, -4 lines 0 comments Download
M cmd/juju/status_test.go View 2 chunks +2 lines, -1 line 0 comments Download
M cmd/juju/synctools.go View 2 chunks +0 lines, -4 lines 0 comments Download
M cmd/juju/synctools_test.go View 2 chunks +2 lines, -1 line 0 comments Download
M cmd/juju/unexpose.go View 1 chunk +0 lines, -3 lines 0 comments Download
M cmd/juju/unexpose_test.go View 2 chunks +2 lines, -1 line 0 comments Download
M cmd/juju/unset.go View 2 chunks +0 lines, -9 lines 0 comments Download
M cmd/juju/unset_test.go View 3 chunks +3 lines, -2 lines 0 comments Download
M cmd/juju/upgradecharm.go View 2 chunks +0 lines, -4 lines 0 comments Download
M cmd/juju/upgradecharm_test.go View 2 chunks +2 lines, -1 line 0 comments Download
M cmd/juju/upgradejuju.go View 1 chunk +0 lines, -4 lines 0 comments Download
M cmd/juju/upgradejuju_test.go View 2 chunks +2 lines, -1 line 0 comments Download
M cmd/plugins/juju-metadata/imagemetadata.go View 2 chunks +0 lines, -8 lines 0 comments Download
M cmd/plugins/juju-metadata/imagemetadata_test.go View 8 chunks +8 lines, -7 lines 0 comments Download
M cmd/plugins/juju-metadata/metadata.go View 2 chunks +5 lines, -4 lines 0 comments Download
M cmd/plugins/juju-metadata/toolsmetadata.go View 1 chunk +0 lines, -8 lines 0 comments Download
M cmd/plugins/juju-metadata/toolsmetadata_test.go View 7 chunks +7 lines, -6 lines 0 comments Download
M cmd/plugins/juju-metadata/validateimagemetadata.go View 2 chunks +0 lines, -4 lines 0 comments Download
M cmd/plugins/juju-metadata/validateimagemetadata_test.go View 10 chunks +11 lines, -10 lines 0 comments Download
M cmd/plugins/juju-metadata/validatetoolsmetadata.go View 2 chunks +0 lines, -4 lines 0 comments Download
M cmd/plugins/juju-metadata/validatetoolsmetadata_test.go View 13 chunks +15 lines, -14 lines 0 comments Download
M cmd/plugins/juju-restore/restore.go View 2 chunks +1 line, -5 lines 0 comments Download

Messages

Total messages: 7
axw
Please take a look.
9 years, 11 months ago (2014-05-12 05:36:37 UTC) #1
wallyworld
LGTM with perhaps a 2nd opinion from William. It does seem that we are missing ...
9 years, 11 months ago (2014-05-12 06:33:30 UTC) #2
fwereade
This LGTM as far as it goes (modulo the need for testing -- I'd like ...
9 years, 11 months ago (2014-05-12 07:24:18 UTC) #3
axw
On 2014/05/12 07:24:18, fwereade wrote: > This LGTM as far as it goes (modulo the ...
9 years, 11 months ago (2014-05-12 07:53:07 UTC) #4
axw
On 2014/05/12 07:53:07, axw wrote: > On 2014/05/12 07:24:18, fwereade wrote: > > This LGTM ...
9 years, 11 months ago (2014-05-12 11:09:21 UTC) #5
axw
Please take a look.
9 years, 11 months ago (2014-05-12 11:11:19 UTC) #6
wallyworld
9 years, 11 months ago (2014-05-12 22:51:04 UTC) #7
On 2014/05/12 11:11:19, axw wrote:
> Please take a look.

LGTM
Sign in to reply to this message.

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