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