33: def destroy_volumes
34:
35: @volume = Rudy::AWS::EC2::Volumes.get(@argv.volid)
36:
37: raise "Volume #{@volume.awsid} does not exist" unless @volume
38: raise "Volume #{@volume.awsid} is still in-use" if @volume.in_use?
39: raise "Volume #{@volume.awsid} is still attached" if @volume.attached?
40: raise "Volume #{@volume.awsid} is not available (#{@volume.state})" unless @volume.available?
41:
42: li "Destroying #{@volume.awsid}"
43: execute_check(:medium)
44: execute_action("Destroy Failed") {
45: Rudy::AWS::EC2::Volumes.destroy(@volume.awsid)
46: true
47: }
48:
49: vol = Rudy::AWS::EC2::Volumes.get(@volume.awsid)
50:
51: li @global.verbose > 1 ? vol.inspect : vol.dump(@@global.format)
52: end