lib/aws_ec2/cleaner/ami.rb in aws-ec2-1.3.0 vs lib/aws_ec2/cleaner/ami.rb in aws-ec2-1.3.1

- old
+ new

@@ -1,21 +1,21 @@ module AwsEc2::Cleaner class Ami < AwsEc2::Base include AwsEc2::AwsService def clean - query = @options[:query] + "*" # use query as base of name for search + query = @options[:query] keep = @options[:keep] || 2 puts "Cleaning out old AMIs with base name: #{@options[:query]}" return if ENV['TEST'] images = search_ami(query) - images.sort_by! { |i| i.name }.reverse + images = images.sort_by { |i| i.name }.reverse delete_list = images[keep..-1] || [] puts "Deleting #{delete_list.size} images." delete_list.each do |i| puts "Deleting image: #{i.image_id} #{i.name}" - delete(i.image_id) + # delete(i.image_id) end end private def delete(image_id)