lib/boxgrinder-build/plugins/delivery/s3/s3-plugin.rb in boxgrinder-build-0.3.6 vs lib/boxgrinder-build/plugins/delivery/s3/s3-plugin.rb in boxgrinder-build-0.3.7

- old
+ new

@@ -26,20 +26,39 @@ module BoxGrinder class S3Plugin < BaseDeliveryPlugin AMI_OSES = { - 'fedora' => ["11"] + 'fedora' => [ '11' ], + 'centos' => [ '5' ], + 'rhel' => [ '5' ] } KERNELS = { 'us_east' => { 'fedora' => { '11' => { 'i386' => { :aki => 'aki-a71cf9ce', :ari => 'ari-a51cf9cc' }, 'x86_64' => { :aki => 'aki-b51cf9dc', :ari => 'ari-b31cf9da' } } + }, + 'centos' => { + '5' => { + 'i386' => { :aki => 'aki-a71cf9ce', :ari => 'ari-a51cf9cc' }, + 'x86_64' => { :aki => 'aki-b51cf9dc', :ari => 'ari-b31cf9da' } + } + }, + 'rhel' => { + '5' => { + 'i386' => { :aki => 'aki-a71cf9ce', :ari => 'ari-a51cf9cc' }, + 'x86_64' => { :aki => 'aki-b51cf9dc', :ari => 'ari-b31cf9da' } + } +# '5' => { +# 'i386' => { :aki => 'aki-e3a54b8a', :ari => 'ari-f9a54b90' }, +# 'x86_64' => { :aki => 'aki-ffa54b96', :ari => 'ari-fda54b94' } +# } + } } } def info @@ -133,16 +152,16 @@ @log.info "Bundling AMI finished." end def image_already_uploaded? begin - bucket = Bucket.find(@aws_helper.aws_data['bucket_name']) + bucket = Bucket.find(@plugin_config['bucket']) rescue return false end - manifest_location = @aws_helper.bucket_manifest_key(@appliance_config.name) + manifest_location = @aws_helper.bucket_manifest_key(@appliance_config.name, @plugin_config['path']) manifest_location = manifest_location[manifest_location.index("/") + 1, manifest_location.length] for object in bucket.objects do return true if object.key.eql?(manifest_location) end @@ -151,22 +170,21 @@ end def upload_image @log.info "Uploading #{@appliance_config.name} AMI to bucket '#{@plugin_config['bucket']}'..." - @exec_helper.execute("ec2-upload-bundle -b #{@aws_helper.bucket_key(@appliance_config.name)} -m #{@ami_manifest} -a #{@plugin_config['access_key']} -s #{@plugin_config['secret_access_key']} --retry") + @exec_helper.execute("ec2-upload-bundle -b #{@aws_helper.bucket_key(@appliance_config.name, @plugin_config['path'])} -m #{@ami_manifest} -a #{@plugin_config['access_key']} -s #{@plugin_config['secret_access_key']} --retry") end def register_image - ami_info = @aws_helper.ami_info(@appliance_config.name) + ami_info = @aws_helper.ami_info(@appliance_config.name, @plugin_config['path']) if ami_info @log.info "Image is registered under id: #{ami_info.imageId}" return else - ami_info = @aws_helper.ec2.register_image(:image_location => @aws_helper.bucket_manifest_key(@appliance_config.name)) + ami_info = @aws_helper.ec2.register_image(:image_location => @aws_helper.bucket_manifest_key(@appliance_config.name, @plugin_config['path'])) @log.info "Image successfully registered under id: #{ami_info.imageId}." end end - end end \ No newline at end of file