Class: VolumesCleanup

Inherits:
VolumesCommand show all
Defined in:
lib/maws/commands/volumes-cleanup.rb

Instance Attribute Summary

Attributes inherited from Command

#connection, #maws

Instance Method Summary collapse

Methods inherited from VolumesCommand

#create_ebs_from_descriptions

Methods inherited from Command

#add_generic_options, #add_specific_options, #initialize, #instances, #process_options, #verify_configs, #verify_options

Constructor Details

This class inherits a constructor from Command

Instance Method Details

#descriptionObject



6
7
8
# File 'lib/maws/commands/volumes-cleanup.rb', line 6

def description
  "volumes-cleaned - delete unattached EBS volumes for specified roles"
end

#run!Object



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/maws/commands/volumes-cleanup.rb', line 10

def run!
  super

  unattached = instances.specified.ebs.matching(:attached? => false)

  if unattached.empty?
    info "no unattached volumes to clean up"
    return
  end

  unattached.each {|i| i.destroy}
end