Class: Topo::Provision::AwsLaunchConfigurationGenerator
- Inherits:
-
ResourceGenerator
- Object
- ResourceGenerator
- Topo::Provision::AwsLaunchConfigurationGenerator
- Extended by:
- Topo::ParseGen
- Defined in:
- lib/topo/provision/aws/generators/aws_launch_configuration.rb
Instance Attribute Summary
Attributes inherited from ResourceGenerator
#name, #resource_attributes, #resource_type, #undeploy_action
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(data, image_id = nil) ⇒ AwsLaunchConfigurationGenerator
constructor
A new instance of AwsLaunchConfigurationGenerator.
- #needs_image? ⇒ Boolean
Methods included from Topo::ParseGen
convert_keys_to_sym, convert_keys_to_sym_deep, expand_ref, lazy_attribute_to_s, topo_refs, value_from_path
Methods inherited from ResourceGenerator
#default_action, #default_resource_template, #deploy, #do_action, #template, #template_root_dir, #undeploy
Constructor Details
#initialize(data, image_id = nil) ⇒ AwsLaunchConfigurationGenerator
Returns a new instance of AwsLaunchConfigurationGenerator.
26 27 28 29 30 31 32 33 34 |
# File 'lib/topo/provision/aws/generators/aws_launch_configuration.rb', line 26 def initialize(data, image_id=nil) @resource_type ||= "aws_launch_configuration" super(data) @image_id = image_id || value_from_path(data, %w[options image_id]) %w[image instance_type options].each do |key| @resource_attributes[key] = data[key] if data.key? key end end |
Class Method Details
.from_node(node) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/topo/provision/aws/generators/aws_launch_configuration.rb', line 40 def self.from_node(node) auto_scaling = value_from_path(node, %w[provisioning node_group auto_scaling]) || {} = auto_scaling['launch_configuration_options'] = value_from_path(node, %w[provisioning machine_options bootstrap_options]) ||= image_id = ['image_id'] .delete('image_id') lc_data = { "name" => auto_scaling['launch_configuration_name'] || node['name'] + "_config", "image" => image_id || auto_scaling['image'] || node['name'] + "_image" } %w[instance_type].each do |key| lc_data[key] = auto_scaling[key] if auto_scaling.key? key end if lc_data['options'] = convert_keys_to_sym_deep() end self.new(lc_data, image_id) end |
Instance Method Details
#needs_image? ⇒ Boolean
36 37 38 |
# File 'lib/topo/provision/aws/generators/aws_launch_configuration.rb', line 36 def needs_image? @image_id.nil? end |