lib/boxgrinder-build/plugins/delivery/elastichosts/elastichosts-plugin.rb in boxgrinder-build-0.9.1 vs lib/boxgrinder-build/plugins/delivery/elastichosts/elastichosts-plugin.rb in boxgrinder-build-0.9.2
- old
+ new
@@ -114,11 +114,12 @@
File.open(@previous_deliverables.disk, 'rb') do |f|
while !f.eof?
f.seek(part * @step, File::SEEK_SET)
- data = compress(f.read(@step))
+ data = f.read(@step)
+ data = compress(data) unless is_cloudsigma?
upload_chunk(data, part)
part += 1
end
end
@@ -146,13 +147,15 @@
url = api_url("/drives/#{@plugin_config['drive_uuid']}/write/#{@step * part}")
begin
@log.info "Uploading part #{part+1}..."
+ headers = {:content_type => "application/octet-stream"}
+ headers['Content-Encoding'] = 'gzip' unless is_cloudsigma?
+
RestClient.post url,
data,
- :content_type => "application/octet-stream",
- 'Content-Encoding' => 'gzip'
+ headers
@log.info "Part #{part+1} uploaded."
rescue => e
@log.warn "An error occured while uploading #{part} chunk, #{e.message}"
try += 1