|
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)
Total comments: 1
|
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
|
Total messages: 7
|