Class: Rivet::LaunchConfig
- Inherits:
-
Object
- Object
- Rivet::LaunchConfig
- Defined in:
- lib/rivet/as/launch_config.rb
Constant Summary collapse
- ATTRIBUTES =
[ :bootstrap, :detailed_instance_monitoring, :spot_price ] + BASE_AWS_ATTRIBUTES
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#id_prefix ⇒ Object
readonly
Returns the value of attribute id_prefix.
Instance Method Summary collapse
- #identity ⇒ Object
-
#initialize(config, id_prefix = 'rivet_') ⇒ LaunchConfig
constructor
A new instance of LaunchConfig.
- #save ⇒ Object
- #user_data ⇒ Object
Constructor Details
#initialize(config, id_prefix = 'rivet_') ⇒ LaunchConfig
Returns a new instance of LaunchConfig.
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/rivet/as/launch_config.rb', line 16 def initialize(config, id_prefix = 'rivet_') @config = config @id_prefix = id_prefix ATTRIBUTES.each do |a| if config.respond_to?(a) Rivet::Log.debug "Setting LaunchConfig @#{a} to #{config.send(a)}" instance_variable_set("@#{a}", config.send(a)) end end end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
14 15 16 |
# File 'lib/rivet/as/launch_config.rb', line 14 def config @config end |
#id_prefix ⇒ Object (readonly)
Returns the value of attribute id_prefix.
14 15 16 |
# File 'lib/rivet/as/launch_config.rb', line 14 def id_prefix @id_prefix end |
Instance Method Details
#identity ⇒ Object
32 33 34 |
# File 'lib/rivet/as/launch_config.rb', line 32 def identity @identity ||= generate_identity end |
#save ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/rivet/as/launch_config.rb', line 36 def save AwsUtils.verify_security_groups(security_groups) lc_collection = AWS::AutoScaling.new.launch_configurations if lc_collection[identity].exists? Rivet::Log.info "Launch configuration #{identity} already exists in AWS" else = {} [:key_pair] = key_name unless key_name.nil? [:security_groups] = security_groups unless security_groups.nil? [:user_data] = user_data unless user_data.nil? [:iam_instance_profile] = iam_instance_profile unless iam_instance_profile.nil? [:associate_public_ip_address] = associate_public_ip_address unless associate_public_ip_address.nil? [:detailed_instance_monitoring] = detailed_instance_monitoring unless detailed_instance_monitoring.nil? [:block_device_mappings] = block_device_mappings unless block_device_mappings.nil? [:kernel_id] = kernel_id unless kernel_id.nil? [:ramdisk_id] = ramdisk_id unless ramdisk_id.nil? [:spot_price] = spot_price unless spot_price.nil? Rivet::Log.info "Saving launch configuration #{identity} to AWS" Rivet::Log.debug "Launch Config options:\n #{.inspect}" lc_collection.create(identity, image_id, instance_type, ) end end |