~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
..
service.go 2263.3.10 10 years ago Nate Finch merge from trunk, fix some compilation errors afte 1 KB Diff Download File
upstart.go 2263.14.29 10 years ago Roger Peppe remove debugging relics 5.6 KB Diff Download File
upstart_test.go 2412.1.1 10 years ago Jesse Meek Change checkers import path change all imports of 7.1 KB Diff Download File