109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
|
# File 'lib/app/image_optimizer.rb', line 109
def parse_args
version = File.open(File.join(File.dirname(__FILE__), "..", "..","VERSION"), "r") { |f| f.read }
@args = Trollop::options do
version "image_optimize #{version} (c) 2014 RightScale, Inc."
banner <<-EOS
Bundle a running VM into a new image that will be used on next launch
Usage:
image_optimize [options]
where [options] are:
EOS
opt :verbose, "If set will enable debug logging. WARNING: will write ec2 creds to log if set!!",
:long => "--verbose", :default => false
opt :image_prefix, "Prefix to add to the optimized image name. Helps when searching for your optimized images.",
:default => "optimized-image", :long => "--prefix", :type => String
opt :image_description, "Description to add to optimized images",
:default => "Cached image", :long => "--description", :type => String
opt :api_user, "RightScale Dashboard User email. Not needed if API_USER_EMAIL environment variable is set.",
:default => ENV['API_USER_EMAIL'], :long => "--api-user", :short => "-u", :type => String
opt :api_password, "RightScale Dashboard User email. Not needed if API_USER_PASSWORD environment variable is set.",
:default => ENV['API_USER_PASSWORD'], :long => "--api-password", :short => "-p", :type => String
opt :do_cleanup, "Don't do any cleanup on VM before snapshotting. Useful for debugging.", :long => "--cleanup", :default => true
opt :aws_access_key, "EC2 Account Access Key. Not needed if AWS_ACCESS_KEY environment variable is set.",
:default => ENV['AWS_ACCESS_KEY'], :long => "--aws-access-key", :short => "-k"
opt :aws_secret_key, "EC2 Account Secret. Not needed if AWS_SECRET_KEY environment variable is set.",
:default => ENV['AWS_SECRET_KEY'], :long => "--aws-secret-key", :short => "-s"
opt :aws_account_number, "EC2 Account ID. Not needed if AWS_ACCOUNT_NUMBER environment variable is set. Required for S3 images only.",
:default => ENV['AWS_ACCOUNT_NUMBER'], :long => "--aws-account-number"
opt :aws_image_type, "The type of image to create from this VM. Must be either 'EBS' or 'S3'. ",
:default => 'EBS', :long => "--aws-image-type", :type => String
opt :aws_kernel_id, "Kernel to use instead of what the VM is running. i.e. 'aki-fc8f11cc'. For a current list of IDs see http://goo.gl/dOS0mB.",
:default => nil, :long => "--aws-kernel-id", :type => String
opt :aws_s3_key_path, "location to file containing EC2 account key. S3 images only.",
:default => '/tmp/certs/x509.key', :long => "--aws-s3-key-path"
opt :aws_s3_cert_path, "location to file containing EC2 account cert. S3 images only.",
:default => '/tmp/certs/x509.cert', :long => "--aws-s3-cert-path"
opt :aws_s3_image_bucket, "The bucket name for optimized S3 images (must be url safe). S3 images only",
:default => "optimized-images", :long => "--aws-s3-image-bucket"
opt :aws_s3_bundle_directory, "The local directory where the image bundle will be stored before uploading to S3. NOTE: this must have enough free space to hold the image bundle.",
:default => "/mnt/ephemeral/bundle", :long => "--aws-s3-bundle-directory"
opt :aws_s3_bundle_no_filter, "If set, will disable the default filtering used by the ec2-bundle-vol command. WARNING: setting this option could leave ssh keys or other secrets on your",
:default => false, :long => "--aws-s3-bundle-no-filter"
end
end
|