From b11f50915695945c7d2ba41f9872557c095bd040 Mon Sep 17 00:00:00 2001 From: Sergio Rubio Date: Tue, 18 Dec 2012 11:58:09 +0100 Subject: [PATCH] [openstack|image] Fixes #1383 --- lib/fog/openstack/requests/image/create_image.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/fog/openstack/requests/image/create_image.rb b/lib/fog/openstack/requests/image/create_image.rb index b9503679f..83efc273b 100644 --- a/lib/fog/openstack/requests/image/create_image.rb +++ b/lib/fog/openstack/requests/image/create_image.rb @@ -16,11 +16,13 @@ module Fog 'x-image-meta-checksum' => attributes[:checksum], 'x-image-meta-owner' => attributes[:owner], 'x-glance-api-copy-from' => attributes[:copy_from] - } + }.reject { |k,v| v.nil? } body = String.new if attributes[:location] body = File.open(attributes[:location], "rb") + # Make sure the image file size is always present + data['x-image-meta-size'] = File.size(body) end unless attributes[:properties].nil?