class ImageBundler

Public Instance Methods

bundle_image(p) click to toggle source
# File lib/ec2/amitools/bundleimage.rb, line 35
def bundle_image(p)
  if p.size_checks
    file_size = File.size(p.image_path)
    if file_size <= 0
      raise "the specified image #{p.image_path} is zero sized"
    elsif file_size > MAX_SIZE
      raise "the specified image #{p.image_path} is too large"
    end
  else
    $stderr.puts 'Warning: disabling size-checks can result in unbootable image'
  end
  
  optional_args = {
    :kernel_id => p.kernel_id,
    :ramdisk_id => p.ramdisk_id,
    :product_codes => p.product_codes,
    :ancestor_ami_ids => p.ancestor_ami_ids,
    :block_device_mapping => p.block_device_mapping,
  }
  $stdout.puts 'Bundling image file...'
  
  Bundle.bundle_image(File::expand_path(p.image_path),
                      p.user,
                      p.arch,
                      Bundle::ImageType::MACHINE,
                      p.destination,
                      p.user_pk_path,
                      p.user_cert_path,
                      p.ec2_cert_path,
                      p.prefix,
                      optional_args,
                      @debug,
                      false)
  
  $stdout.puts( "#{BUNDLE_IMAGE_NAME} complete." )
end
get_manual() click to toggle source
# File lib/ec2/amitools/bundleimage.rb, line 76
def get_manual()
  BUNDLE_IMAGE_MANUAL
end
get_name() click to toggle source
# File lib/ec2/amitools/bundleimage.rb, line 80
def get_name()
  BUNDLE_IMAGE_NAME
end
main(p) click to toggle source
# File lib/ec2/amitools/bundleimage.rb, line 84
def main(p)
  bundle_image(p)
end