capistrano-asg 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 65590a9ec7bb5ea9e7989900db32e3186d113dc1
4
- data.tar.gz: 1de9dbe90e304d5bf31a46444fbd912d0445bbce
3
+ metadata.gz: b8fee06727da83250152a1719178d144e40bc7a0
4
+ data.tar.gz: 5c5a4b5a946c92450049dc0ffbc8980f1bdd9781
5
5
  SHA512:
6
- metadata.gz: e7318766a16a55a0a8668e55fe0efaee988ea7e1ba7a6635fdcaf5b6b5158b01458d7617aa0dd13afc8995d891c65cae2011cb62c70177a68a3a67fa2c077f8d
7
- data.tar.gz: d656273906059100458d400dd04ec9f539b3f5d62f4dfa2afa9e2c6250bd3482b076b4d94639fad5fbc68fad9ad8a327885ff3ff38c5269633c777cc16002b9d
6
+ metadata.gz: 47a3d0b10852dacef4defe899d13c6109c2093fdad6d6b703014415ecec8e7ecbb981a634b559a66e833df1d5a55b0a6fa3a58d463da576bf51f881bc663f6d9
7
+ data.tar.gz: d4e1487c935cd83ea6f5b24c66a12e9e40f268f98da5ec47174fe89769b7ffc1b5ed774db2ecaa962bbd6e92a4bdb7ad1847365bcc605e79ca39026b7b5d3413
@@ -11,8 +11,7 @@ module Capistrano
11
11
  end
12
12
 
13
13
  def save(ami)
14
- info "Creating an EC2 Launch Configuration for AMI: \
15
- #{ami.aws_counterpart.id}"
14
+ info "Creating an EC2 Launch Configuration for AMI: #{ami.aws_counterpart.id}"
16
15
  ec2_instance = ec2_resource.instance(base_ec2_instance.id)
17
16
  with_retry do
18
17
  @aws_counterpart = autoscaling_resource.create_launch_configuration(
@@ -31,8 +30,7 @@ module Capistrano
31
30
  end
32
31
 
33
32
  def attach_to_autoscale_group!
34
- info "Attaching Launch Configuration #{aws_counterpart.name} \
35
- to AutoScaling Group #{autoscaling_group.name}"
33
+ info "Attaching Launch Configuration #{aws_counterpart.name} to AutoScaling Group #{autoscaling_group.name}"
36
34
  autoscaling_group.update(
37
35
  launch_configuration_name: aws_counterpart.name
38
36
  )
@@ -4,13 +4,21 @@ namespace :asg do
4
4
  task :scale do
5
5
  set :aws_access_key_id, fetch(:aws_access_key_id, ENV['AWS_ACCESS_KEY_ID'])
6
6
  set :aws_secret_access_key, fetch(:aws_secret_access_key, ENV['AWS_SECRET_ACCESS_KEY'])
7
- set :aws_region, fetch(:aws_region, ENV['AWS_REGION'])
8
7
 
9
- Capistrano::Asg::AMI.create do |ami|
10
- puts "Autoscaling: Created AMI: #{ami.aws_counterpart.id}"
11
- Capistrano::Asg::LaunchConfiguration.create(ami) do |lc|
12
- puts "Autoscaling: Created Launch Configuration: #{lc.aws_counterpart.name}"
13
- lc.attach_to_autoscale_group!
8
+ # Iterate over relevant regions
9
+ regions = fetch(:regions)
10
+ regions.keys.each do |region|
11
+ set :aws_region, region
12
+ # Iterate over relevant ASGs
13
+ regions[region].each do |asg|
14
+ set :aws_autoscale_group, asg
15
+ Capistrano::Asg::AMI.create do |ami|
16
+ puts "Autoscaling: Created AMI: #{ami.aws_counterpart.id} from region #{region} in ASG #{asg}"
17
+ Capistrano::Asg::LaunchConfiguration.create(ami) do |lc|
18
+ puts "Autoscaling: Created Launch Configuration: #{lc.aws_counterpart.name} from region #{region} in ASG #{asg}"
19
+ lc.attach_to_autoscale_group!
20
+ end
21
+ end
14
22
  end
15
23
  end
16
24
  end
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module Asg
3
- VERSION = '0.5.0'.freeze
3
+ VERSION = '0.5.1'.freeze
4
4
  end
5
5
  end
@@ -32,6 +32,10 @@ def autoscale(groupname, *args)
32
32
  asg_instances = autoscaling_group.instances
33
33
 
34
34
  set :aws_autoscale_group, groupname
35
+ region = fetch(:aws_region)
36
+ regions = fetch(:regions, {})
37
+ (regions[region] ||= []) << groupname
38
+ set :regions, regions
35
39
 
36
40
  asg_instances.each do |asg_instance|
37
41
  if asg_instance.health_status != 'Healthy'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-asg
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Logan Serman