~hduran-8/juju-core/trunk

  • Committer: Tarmac
  • Author(s): Andrew Wilkins
  • Date: 2014-05-13 01:48:02 UTC
  • mfrom: (2713.1.5 envcmd-inversion)
  • Revision ID: tarmac-20140513014802-d1n958os00gw27zf
[r=axwalk] 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://codereview.appspot.com/94350045/
Filename Latest Rev Last Changed Committer Comment Size
..
list.go 2687.1.1 10 years ago Menno Smits Make doc comments match function names 4.4 KB Diff Download File
list_test.go 2049.2.5 10 years ago Dimiter Naydenov Changes after review 7 KB Diff Download File
marshal.go 1870.1.1 10 years ago Ian Booth When tools are unpacked, an error is raised if the 919 bytes Diff Download File
marshal_test.go 1870.1.1 10 years ago Ian Booth When tools are unpacked, an error is raised if the 1.4 KB Diff Download File
package_test.go 1603.8.7 10 years ago Ian Booth Test tweaks 210 bytes Diff Download File
tools.go 2706.1.1 10 years ago John Arbash Meinel merge 1.18 r2280 which is only cherrypicks back fr 588 bytes Diff Download File