Class: Stemcell::MetadataLauncher

Inherits:
Object
  • Object
show all
Defined in:
lib/stemcell/metadata_launcher.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ MetadataLauncher

Returns a new instance of MetadataLauncher.

Raises:

  • (ArgumentError)


8
9
10
11
12
13
14
15
# File 'lib/stemcell/metadata_launcher.rb', line 8

def initialize(options={})
  @chef_root = options[:chef_root]
  @interactive = options.fetch(:interactive, false)

  raise ArgumentError, "You must specify chef_root" unless chef_root

  @source = MetadataSource.new(chef_root)
end

Instance Attribute Details

#chef_rootObject (readonly)

Returns the value of attribute chef_root.



3
4
5
# File 'lib/stemcell/metadata_launcher.rb', line 3

def chef_root
  @chef_root
end

#interactiveObject

Returns the value of attribute interactive.



4
5
6
# File 'lib/stemcell/metadata_launcher.rb', line 4

def interactive
  @interactive
end

#sourceObject (readonly)

Returns the value of attribute source.



6
7
8
# File 'lib/stemcell/metadata_launcher.rb', line 6

def source
  @source
end

Instance Method Details

#default_optionsObject



26
27
28
# File 'lib/stemcell/metadata_launcher.rb', line 26

def default_options
  source.default_options
end

#run!(role, override_options = {}) ⇒ Object



17
18
19
20
21
22
23
24
# File 'lib/stemcell/metadata_launcher.rb', line 17

def run!(role, override_options={})
  environment = expand_environment(override_options)
  launch_options = determine_options(role, environment, override_options)

  validate_options(launch_options)
  describe_instance(launch_options)
  invoke_launcher(launch_options)
end