~dave-cheney/juju-core/153-fix-release-tools-script

« back to all changes in this revision

Viewing changes to provider/local/environ.go

  • Committer: Tarmac
  • Author(s): Andrew Wilkins
  • Date: 2013-08-30 01:48:39 UTC
  • mfrom: (1628.11.22 juju-add-machine)
  • Revision ID: tarmac-20130830014839-infsllif52ywy6yq
[r=axwalk] Update add-machine for manual provisioning

juju add-machine is updated to use a new package,
environs/manual, to manually provision tools and
a machine agent to an existing machine.

When a manually provisioned machine is destroyed
via juju destroy-machine, the machine agent will
detect its termination and remove its upstart
configuration file. There is currently no cleanup
of the data or log directories; this will be done
in a follow-up pending discussion.

When the machine goes to Dead, a provisioner will
remove the machine from state just like any other
machine.

TODO: destroy-environment will currently leak
manually provisioned machines. A follow-up will
address this by requiring users to individually
destroy-machine before destroy-environment will
proceed. Alternatively (or perhaps additionally),
destroy-environment may take a flag to automatically
do this.

https://codereview.appspot.com/12831043/

Show diffs side-by-side

added added

removed removed

Lines of Context:
346
346
        logger.Infof("removing service %s", env.machineAgentServiceName())
347
347
        machineAgent := upstart.NewService(env.machineAgentServiceName())
348
348
        machineAgent.InitDir = upstartScriptLocation
349
 
        if err := machineAgent.Remove(); err != nil {
 
349
        if err := machineAgent.StopAndRemove(); err != nil {
350
350
                logger.Errorf("could not remove machine agent service: %v", err)
351
351
                return err
352
352
        }
354
354
        logger.Infof("removing service %s", env.mongoServiceName())
355
355
        mongo := upstart.NewService(env.mongoServiceName())
356
356
        mongo.InitDir = upstartScriptLocation
357
 
        if err := mongo.Remove(); err != nil {
 
357
        if err := mongo.StopAndRemove(); err != nil {
358
358
                logger.Errorf("could not remove mongo service: %v", err)
359
359
                return err
360
360
        }