~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
..
factory.go 2357.3.2 10 years ago Jesse Meek Cleaned up code as per thumper's feedback 766 bytes Diff Download File
factory_test.go 2397.1.2 10 years ago Jesse Meek Fixes test. 1.1 KB Diff Download File
package_test.go 1863.5.39 10 years ago Tim Penhey Merged container-factory into kvm-local-provider. 212 bytes Diff Download File