diff --git a/lib/fog/aws/requests/compute/create_image.rb b/lib/fog/aws/requests/compute/create_image.rb index a431eb927..6a2f5d14d 100644 --- a/lib/fog/aws/requests/compute/create_image.rb +++ b/lib/fog/aws/requests/compute/create_image.rb @@ -63,12 +63,16 @@ module Fog params.merge!Fog::AWS.indexed_param('BlockDeviceMapping.%d.Ebs.Iops', block_device_mappings.map{|mapping| mapping['Ebs.Iops']}) params.reject!{|k,v| v.nil?} + reserved_ebs_root_device = '/dev/sda1' + block_devices = options.delete(:block_device_mappings) || [] + register_image_response = register_image(name, description, reserved_ebs_root_device, block_devices, options) + response = Excon::Response.new if instance_id && !name.empty? response.status = 200 response.body = { 'requestId' => Fog::AWS::Mock.request_id, - 'imageId' => Fog::AWS::Mock.image_id + 'imageId' => register_image_response.body['imageId'] } else response.status = 400 diff --git a/tests/aws/requests/compute/image_tests.rb b/tests/aws/requests/compute/image_tests.rb index 11bc0f000..c674b053f 100644 --- a/tests/aws/requests/compute/image_tests.rb +++ b/tests/aws/requests/compute/image_tests.rb @@ -63,6 +63,10 @@ Shindo.tests('Fog::Compute[:aws] | image requests', ['aws']) do @created_image = Fog::Compute[:aws].images.get(result['imageId']) result end + tests("#create_image - automatic ebs image registration").returns(true) do + create_image_response = Fog::Compute[:aws].create_image(@server.id, 'Fog-Test-Image', 'Fog Test Image') + Fog::Compute[:aws].images.get(create_image_response.body['imageId']) != nil + end @server.destroy tests("#register_image").formats(@register_image_format) do @@ -123,4 +127,4 @@ Shindo.tests('Fog::Compute[:aws] | image requests', ['aws']) do Fog::Compute[:aws].modify_image_attribute('ami-00000000', { 'Add.UserId' => ['123456789012'] }).body end end -end +end \ No newline at end of file