1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

Merge pull request #1230 from ZimChi/develop

[AWS::Mock|create_image] automatic registration of ebs image upon image_...
This commit is contained in:
Wesley Beary 2012-10-26 08:56:58 -07:00
commit e67eba360c
2 changed files with 10 additions and 2 deletions

View file

@ -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.merge!Fog::AWS.indexed_param('BlockDeviceMapping.%d.Ebs.Iops', block_device_mappings.map{|mapping| mapping['Ebs.Iops']})
params.reject!{|k,v| v.nil?} 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 response = Excon::Response.new
if instance_id && !name.empty? if instance_id && !name.empty?
response.status = 200 response.status = 200
response.body = { response.body = {
'requestId' => Fog::AWS::Mock.request_id, 'requestId' => Fog::AWS::Mock.request_id,
'imageId' => Fog::AWS::Mock.image_id 'imageId' => register_image_response.body['imageId']
} }
else else
response.status = 400 response.status = 400

View file

@ -63,6 +63,10 @@ Shindo.tests('Fog::Compute[:aws] | image requests', ['aws']) do
@created_image = Fog::Compute[:aws].images.get(result['imageId']) @created_image = Fog::Compute[:aws].images.get(result['imageId'])
result result
end 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 @server.destroy
tests("#register_image").formats(@register_image_format) do 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 Fog::Compute[:aws].modify_image_attribute('ami-00000000', { 'Add.UserId' => ['123456789012'] }).body
end end
end end
end end