Class: Forger::Cleaner::Ami
- Includes:
- AwsServices
- Defined in:
- lib/forger/cleaner/ami.rb
Constant Summary
Constants inherited from Base
Base::BUILD_ROOT, Base::SCRIPTS_INFO_PATH
Instance Method Summary collapse
Methods included from AwsServices
Methods inherited from Base
#derandomize, #initialize, #randomize
Constructor Details
This class inherits a constructor from Forger::Base
Instance Method Details
#clean ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/forger/cleaner/ami.rb', line 5 def clean 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 = images.sort_by { |i| i.name }.reverse delete_list = images[keep..-1] || [] puts "Deleting #{delete_list.size} images." delete_list.each do |i| delete(i) end end |