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:
parent
8d758076bf
commit
a47c23bbf0
1 changed files with 3 additions and 1 deletions
|
@ -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
|
||||||
|
|
Loading…
Add table
Reference in a new issue