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
|
||||
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
|
||||
|
|
Loading…
Add table
Reference in a new issue