capistrano-autoscaling 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -38,6 +38,9 @@ To enable this recipe, add following in your `config/deploy.rb`.
38
38
  set(:autoscaling_max_size, 10)
39
39
  after "deploy:setup", "autoscaling:setup"
40
40
  after "deploy", "autoscaling:update"
41
+ after "deploy:cold", "autoscaling:update"
42
+ after "deploy:rollback", "autoscaling:update"
43
+ after "autoscaling:update", "autoscaling:cleanup"
41
44
 
42
45
  TODO: Write usage instructions here
43
46
 
@@ -161,7 +161,8 @@ module Capistrano
161
161
  _cset(:autoscaling_ec2_instance_private_dns_names) { autoscaling_ec2_instances.map { |instance| instance.private_dns_name } }
162
162
 
163
163
  ## AMI
164
- _cset(:autoscaling_image_name) { "#{autoscaling_ec2_instance_name}/#{autoscaling_timestamp}" }
164
+ _cset(:autoscaling_image_name_prefix) { "#{autoscaling_application}/" }
165
+ _cset(:autoscaling_image_name) { "#{autoscaling_image_name_prefix}#{autoscaling_timestamp}" }
165
166
  _cset(:autoscaling_image_instance) {
166
167
  if 0 < autoscaling_ec2_instances.length
167
168
  autoscaling_ec2_instances.reject { |instance| instance.root_device_type != :ebs }.last
@@ -174,10 +175,10 @@ module Capistrano
174
175
  }
175
176
  _cset(:autoscaling_image_tag_name) { autoscaling_application }
176
177
  _cset(:autoscaling_image) {
177
- autoscaling_ec2_client.images.with_owner("self").tagged("Name").tagged_values(autoscaling_image_name).to_a.first
178
+ autoscaling_ec2_client.images.with_owner("self").filter("name", autoscaling_image_name).to_a.first
178
179
  }
179
180
  _cset(:autoscaling_images) {
180
- autoscaling_ec2_client.images.with_owner("self").tagged(autoscaling_image_tag_name).reject { |image| image.state != :available }
181
+ autoscaling_ec2_client.images.with_owner("self").filter("name", "#{autoscaling_image_name_prefix}*").to_a
181
182
  }
182
183
 
183
184
  ## LaunchConfiguration
@@ -554,9 +555,10 @@ module Capistrano
554
555
 
555
556
  desc("Delete old AMIs.")
556
557
  task(:cleanup, :roles => :app, :except => { :no_release => true }) {
557
- images = autoscaling_images.sort { |x, y| x.name <=> y.name }.reject { |image|
558
- autoscaling_group.launch_configuration.image_id == image.id
559
- }
558
+ images = autoscaling_images.sort { |x, y| x.name <=> y.name }
559
+ if autoscaling_group and autoscaling_group.exists?
560
+ images = images.reject { |image| autoscaling_group.launch_configuration.image_id == image.id }
561
+ end
560
562
  (images - images.last(autoscaling_keep_images-1)).each do |image|
561
563
  if autoscaling_create_image and ( image and image.exists? )
562
564
  snapshots = image.block_device_mappings.map { |device, block_device| block_device.snapshot_id }
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module AutoScaling
3
- VERSION = "0.0.2"
3
+ VERSION = "0.0.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-autoscaling
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-22 00:00:00.000000000 Z
12
+ date: 2012-11-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: capistrano