lib/boxgrinder-build/plugins/delivery/s3/s3-plugin.rb in boxgrinder-build-0.9.8 vs lib/boxgrinder-build/plugins/delivery/s3/s3-plugin.rb in boxgrinder-build-0.10.0

- old
+ new

@@ -23,10 +23,11 @@ require 'boxgrinder-build/helpers/s3-helper' require 'boxgrinder-build/helpers/ec2-helper' module BoxGrinder class S3Plugin < BasePlugin + plugin :type => :delivery, :name => :s3, :full_name => "Amazon Simple Storage Service (Amazon S3)", :types => [:s3, :cloudfront, :ami] def after_init register_supported_os("fedora", ['13', '14', '15', '16']) register_supported_os("centos", ['5', '6']) register_supported_os("rhel", ['5', '6']) @@ -36,10 +37,12 @@ @ami_manifest = "#{@ami_build_dir}/#{@appliance_config.name}.ec2.manifest.xml" end def validate set_default_config_value('overwrite', false) + set_default_config_value('kernel', false) + set_default_config_value('ramdisk', false) set_default_config_value('path', '/') set_default_config_value('region', 'us-east-1') validate_plugin_config(['bucket', 'access_key', 'secret_access_key'], 'http://boxgrinder.org/tutorials/boxgrinder-build-plugins/#S3_Delivery_Plugin') subtype(:ami) do @@ -151,12 +154,23 @@ @log.info "Bundling AMI..." FileUtils.mkdir_p(@ami_build_dir) - @exec_helper.execute("euca-bundle-image --ec2cert #{File.dirname(__FILE__)}/src/cert-ec2.pem -i #{deliverables[:disk]} --kernel #{@s3_endpoints[@plugin_config['region']][:kernel][@appliance_config.hardware.base_arch.intern][:aki]} -c #{@plugin_config['cert_file']} -k #{@plugin_config['key_file']} -u #{@plugin_config['account_number']} -r #{@appliance_config.hardware.base_arch} -d #{@ami_build_dir}", :redacted => [@plugin_config['account_number'], @plugin_config['key_file'], @plugin_config['cert_file']]) + cmd_str = "euca-bundle-image --ec2cert #{File.dirname(__FILE__)}/src/cert-ec2.pem " << + "-i #{deliverables[:disk]} " << + "--kernel #{@plugin_config['kernel'] || @s3_endpoints[@plugin_config['region']][:kernel][@appliance_config.hardware.base_arch.intern][:aki]} " << + "-c #{@plugin_config['cert_file']} "<< + "-k #{@plugin_config['key_file']} " << + "-u #{@plugin_config['account_number']} " << + "-r #{@appliance_config.hardware.base_arch} " << + "-d #{@ami_build_dir} " + cmd_str << "--ramdisk #{@plugin_config['ramdisk']}" if @plugin_config['ramdisk'] + + @exec_helper.execute(cmd_str, :redacted => [@plugin_config['account_number'], @plugin_config['key_file'], @plugin_config['cert_file']]) + @log.info "Bundling AMI finished." end def upload_image(ami_dir) @log.info "Uploading #{@appliance_config.name} AMI to bucket '#{@plugin_config['bucket']}'..." @@ -214,6 +228,5 @@ end end end -plugin :class => BoxGrinder::S3Plugin, :type => :delivery, :name => :s3, :full_name => "Amazon Simple Storage Service (Amazon S3)", :types => [:s3, :cloudfront, :ami]