Class Rudy::CLI::AWS::EC2::Volumes

  1. lib/rudy/cli/aws/ec2/volumes.rb

Public instance methods

destroy_volumes ()
[show source]
    # File lib/rudy/cli/aws/ec2/volumes.rb, line 33
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
destroy_volumes_valid? ()
[show source]
    # File lib/rudy/cli/aws/ec2/volumes.rb, line 24
24:     def destroy_volumes_valid?
25:       raise "You must supply a volume ID. See rudy volume -h" unless @argv.volid    
26:       
27:       unless Rudy::AWS::EC2::Volumes.exists? @argv.volid
28:         raise Rudy::AWS::EC2::UnknownVolume, @argv.volid
29:       end
30:       true
31:     end
volumes ()
[show source]
     # File lib/rudy/cli/aws/ec2/volumes.rb, line 95
 95:     def volumes
 96:       volumes = Rudy::AWS::EC2::Volumes.list || []
 97:       volumes.each do |vol|
 98:         li @global.verbose > 1 ? vol.inspect : vol.dump(@@global.format)
 99:       end
100:     end
volumes_attach ()
[show source]
    # File lib/rudy/cli/aws/ec2/volumes.rb, line 60
60:     def volumes_attach
61:       @option.device ||= "/dev/sdh"
62:       raise "Volume #{@argv.volid} does not exist" unless Rudy::AWS::EC2::Volumes.exists?(@argv.volid)
63:       raise "Volume #{@argv.volid} is already attached" if Rudy::AWS::EC2::Volumes.attached?(@argv.volid)
64:       raise "Instance #{@option.instance} does not exist" unless Rudy::AWS::EC2::Instances.exists?(@option.instance)
65:       
66:       li "Attaching #{@argv.volid} to #{@option.instance} on #{@option.device}"
67:       execute_check(:low)
68:       execute_action("Attach Failed") { 
69:         Rudy::AWS::EC2::Volumes.attach(@argv.volid, @option.instance, @option.device) 
70:       }
71:       
72:       vol = Rudy::AWS::EC2::Volumes.get(@argv.volid)
73:       li @global.verbose > 1 ? vol.inspect : vol.dump(@@global.format)
74:     end
volumes_attach_valid? ()
[show source]
    # File lib/rudy/cli/aws/ec2/volumes.rb, line 55
55:     def volumes_attach_valid?
56:       raise "You must supply an instance ID." unless @option.instance
57:       raise "You must supply a volume ID." unless @argv.volid
58:       true
59:     end
volumes_create ()
[show source]
    # File lib/rudy/cli/aws/ec2/volumes.rb, line 14
14:     def volumes_create
15:       li "Creating #{@option.size}GB volume in #{@@global.zone}"
16:       execute_check(:low)
17:       vol = execute_action("Create Failed") { 
18:         Rudy::AWS::EC2::Volumes.create(@option.size, @@global.zone, @option.snapshot) 
19:       }
20:       li @global.verbose > 1 ? vol.inspect : vol.dump(@@global.format)
21:     end
volumes_create_valid? ()
[show source]
    # File lib/rudy/cli/aws/ec2/volumes.rb, line 9
 9:     def volumes_create_valid?
10:       raise "You must supply a volume size. See rudy volume -h" unless @option.size
11:       raise "You must supply a zone." unless @@global.zone
12:       true
13:     end
volumes_detach ()
[show source]
    # File lib/rudy/cli/aws/ec2/volumes.rb, line 81
81:     def volumes_detach
82:       raise "Volume #{@argv.volid} does not exist" unless Rudy::AWS::EC2::Volumes.exists?(@argv.volid)
83:       vol = Rudy::AWS::EC2::Volumes.get(@argv.volid)
84:       raise "Volume #{vol.awsid} is not attached" unless vol.attached?
85:       
86:       li "Detaching #{vol.awsid} from #{vol.instid}"
87:       execute_check(:medium)
88:       execute_action("Detach Failed") { Rudy::AWS::EC2::Volumes.detach(vol.awsid) }
89:       
90:       vol = Rudy::AWS::EC2::Volumes.get(vol.awsid)
91:       li @global.verbose > 1 ? vol.inspect : vol.dump(@@global.format)
92:     end
volumes_detach_valid? ()
[show source]
    # File lib/rudy/cli/aws/ec2/volumes.rb, line 76
76:     def volumes_detach_valid?
77:       raise "You must supply a volume ID." unless @argv.volid
78:       true
79:     end