Class: MotherBrain::Provisioner::AWS

Inherits:
Base
  • Object
show all
Defined in:
lib/mb/provisioners/aws.rb

Overview

Provisioner adapter for AWS/Eucalyptus

Instance Attribute Summary

Attributes inherited from Base

#options

Instance Method Summary collapse

Methods inherited from Base

#initialize, register_provisioner, validate_create

Methods included from Logging

add_argument_header, dev, filename, #log_exception, logger, #logger, reset, set_logger, setup

Constructor Details

This class inherits a constructor from MotherBrain::Provisioner::Base

Instance Method Details

#down(job, environment, options = {}) ⇒ Object

Terminate instances for the given environment

Parameters:

  • job (Job)

    a job to track the progress of this action

  • environment (String)
  • options (Hash) (defaults to: {})


41
42
43
44
45
46
47
# File 'lib/mb/provisioners/aws.rb', line 41

def down(job, environment, options = {})
  job.set_status "Searching for instances to terminate"
  instance_ids = instance_ids_for_environment(environment)

  terminate_instance_ids job, instance_ids
  remove_provision_data job, environment, instance_ids
end

#up(job, env_name, manifest, plugin, options = {}) ⇒ Array<Hash>

Provision nodes in the environment based on the contents of the given manifest

Parameters:

  • job (Job)

    a job to track the progress of this action

  • env_name (String)

    the name of the environment to put the nodes in

  • manifest (Provisioner::Manifest)

    a manifest describing the way the environment should look

  • plugin (Plugin)

Returns:

  • (Array<Hash>)

Raises:



24
25
26
27
28
29
30
31
32
33
# File 'lib/mb/provisioners/aws.rb', line 24

def up(job, env_name, manifest, plugin, options = {})
  job.set_status "Starting provision"
  fog = fog_connection(manifest)
  validate_manifest_options(job, manifest)
  instances = create_instances(job, manifest, fog)
  store_provision_data job, env_name, instances_as_manifest(instances)
  verified_instances = verify_instances(job, fog, instances)
  verify_connection(job, fog, manifest, verified_instances)
  instances_as_manifest(verified_instances)
end