Class Rudy::CLI::Images

  1. lib/rudy/cli/images.rb

Public instance methods

bundle ()
[show source]
    # File lib/rudy/cli/images.rb, line 19
19:       def bundle
20: 
21:         @machines.each do |m|
22:           li machine_separator(m.name, m.instid)
23: 
24:           cmd = "ec2-bundle-instance"
25:           args = [m.instid, "--region", @@global.region.to_s]
26:           args += ["-b", @@global.bucket, "-p", @argv.name]
27:           args += ["-o", @@global.accesskey, "-w", @@global.secretkey]
28:           args += ["-K", @@global.pkey, "-C", @@global.cert]
29:           
30:           # S3 returned 301 (Moved Permanently) for ACL on bucket [EU-BUCKET]
31:           args += ["--no-bucket-setup"] if @@global.region.to_s == 'eu-west-1'
32:           
33:           if @@global.verbose > 0
34:             li "Running: " << Rye.prepare_command(cmd, args), $/
35:           end
36:           
37:           unless @@global.quiet
38:             li "Bundling can take up to 60 minutes."
39:             li "Check the status with the following command:"
40:             li Rudy::Huxtable.generate_rudy_command('bundle-status').bright
41:             li $/, "When complete, register the image with the command:"
42:             li Rudy::Huxtable.generate_rudy_command('images', '-R', @argv.name).bright
43:           end
44:           
45:           execute_check(:medium)
46:           
47:           ret = Rye.shell cmd, args
48:           li ret.stderr, ret.stdout
49:         end
50:       end
bundle_status ()
[show source]
    # File lib/rudy/cli/images.rb, line 52
52:       def bundle_status
53:         cmd = 'ec2-describe-bundle-tasks'
54:         args = ["--region", @@global.region.to_s]
55:         args += ["-K", @@global.pkey, "-C", @@global.cert]
56:         
57:         if @@global.verbose > 0
58:           li "Running: " << Rye.prepare_command(cmd, args), $/
59:         end
60:         
61:         ret = Rye.shell cmd, args
62:         li ret.stderr, ret.stdout
63:           
64:       end
bundle_valid? ()
[show source]
    # File lib/rudy/cli/images.rb, line 6
 6:       def bundle_valid?
 7:         raise "No S3 bucket provided. See rudy bundle -h" unless @@global.bucket
 8:         raise "No image name provided. See rudy bundle -h" unless @argv.name
 9:           
10:         @machines = Rudy::Machines.list
11:         raise "No machines" if @machines.nil?
12:         
13:         @machines = @machines.select { |m| m.windows? }
14:         raise "No Windows machines" if @machines.nil?
15:         
16:         true
17:       end
deregister_images ()
[show source]
    # File lib/rudy/cli/images.rb, line 83
83:       def deregister_images
84:         execute_check(:low)
85:         li Rudy::AWS::EC2::Images.deregister(@argv.ami) ? "Done" : "Unknown error"
86:       end
deregister_images_valid? ()
[show source]
    # File lib/rudy/cli/images.rb, line 77
77:       def deregister_images_valid?
78:         unless @argv.first && Rudy::Utils.is_id?(:image, @argv.first)  
79:           raise "Must supply an AMI ID. See rudy images -h" 
80:         end
81:         true
82:       end
images ()
[show source]
    # File lib/rudy/cli/images.rb, line 88
88:       def images
89:         @option.owner ||= 'self'
90:         images = Rudy::AWS::EC2::Images.list(@option.owner, @argv) || []
91:         print_stobjects images
92:       end
register_images ()
[show source]
    # File lib/rudy/cli/images.rb, line 72
72:       def register_images
73:         name = "#{@@global.bucket}/#{@argv.name}.manifest.xml"
74:         li Rudy::AWS::EC2::Images.register(name)
75:       end
register_images_valid? ()
[show source]
    # File lib/rudy/cli/images.rb, line 66
66:       def register_images_valid?
67:         raise "No S3 bucket provided. See rudy bundle -h" unless @@global.bucket
68:         raise "No image name provided. See rudy bundle -h" unless @argv.name
69:         
70:         true
71:       end