Class: Tapjoy::AutoscalingBootstrap::Autoscaling::Config
- Inherits:
-
Object
- Object
- Tapjoy::AutoscalingBootstrap::Autoscaling::Config
- Defined in:
- lib/tapjoy/autoscaling_bootstrap/autoscaling/config.rb
Overview
Code specific to Launch Configs
Instance Method Summary collapse
-
#create(config, aws_env, user_data) ⇒ Object
Create launch configuration.
- #delete ⇒ Object
-
#exists ⇒ Object
Check if launch configuration exists.
Instance Method Details
#create(config, aws_env, user_data) ⇒ Object
Create launch configuration
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/tapjoy/autoscaling_bootstrap/autoscaling/config.rb', line 8 def create(config, aws_env, user_data) if exists delete else puts "Launch config #{Tapjoy::AutoscalingBootstrap.config_name} does not exist, continuing..." end puts "Creating launch config: #{Tapjoy::AutoscalingBootstrap.config_name}" begin Tapjoy::AutoscalingBootstrap::Base.new.sec_group_exists( aws_env[:security_groups]) unless config[:vpc_subnets] Tapjoy::AutoscalingBootstrap::AWS::Autoscaling::LaunchConfig.create( **config, **aws_env, user_data: user_data) rescue Aws::AutoScaling::Errors::ValidationError => err abort("Cannot create launch configuration: #{err}") rescue Aws::AutoScaling::Errors::LimitExceeded => err abort("Maximum launch configurations exceeded: #{err}") end end |
#delete ⇒ Object
35 36 37 38 |
# File 'lib/tapjoy/autoscaling_bootstrap/autoscaling/config.rb', line 35 def delete puts "Deleting launch config #{Tapjoy::AutoscalingBootstrap.config_name}" Tapjoy::AutoscalingBootstrap::AWS::Autoscaling::LaunchConfig.delete end |
#exists ⇒ Object
Check if launch configuration exists
30 31 32 33 |
# File 'lib/tapjoy/autoscaling_bootstrap/autoscaling/config.rb', line 30 def exists !Tapjoy::AutoscalingBootstrap::AWS::Autoscaling::LaunchConfig.describe( Tapjoy::AutoscalingBootstrap.config_name).nil? end |