1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

[openstack|image] Stream OpenStack image

The excon gem already supports passing in a File for the body
instead of a String. Also close the file after the request has been
processed.
This commit is contained in:
Vadim Spivak 2012-07-16 15:48:14 -07:00
parent 8d758076bf
commit a47c23bbf0

View file

@ -20,7 +20,7 @@ module Fog
body = String.new body = String.new
if attributes[:location] if attributes[:location]
file = File.open(attributes[:location], "rb") file = File.open(attributes[:location], "rb")
body = file.read body = file
end end
unless attributes[:properties].nil? unless attributes[:properties].nil?
@ -38,6 +38,8 @@ module Fog
:method => 'POST', :method => 'POST',
:path => "images" :path => "images"
) )
ensure
body.close if body.respond_to?(:close)
end end
end end