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

[ec2] simplify server model create process

This commit is contained in:
geemus 2010-05-18 11:22:32 -07:00
parent 04aaecd9cb
commit b450dda27c

View file

@ -115,28 +115,18 @@ module Fog
def save
requires :image_id
options = {'InstanceType' => flavor.id}
if @availability_zone
options['Placement.AvailabilityZone'] = @availability_zone
end
unless @groups.empty?
options['SecurityGroup'] = @groups
end
if @kernel_id
options['KernelId'] = @kernel_id
end
if @key_name
options['KeyName'] = @key_name
end
if @monitoring
options['Monitoring.Enabled'] = @monitoring
end
if @ramdisk_id
options['RamdiskId'] = @ramdisk_id
end
if @user_data
options['UserData'] = @user_data
end
options = {
'BlockDeviceMapping' => @block_device_mapping,
'InstanceType' => flavor.id,
'KernelId' => @kernel_id,
'KeyName' => @key_name,
'Monitoring.Enabled' => @monitoring,
'Placement.AvailabilityZone' => @availability_zone,
'RamdiskId' => @ramdisk_id,
'SecurityGroup' => @groups,
'UserData' => @user_data
}
data = connection.run_instances(@image_id, 1, 1, options)
merge_attributes(data.body['instancesSet'].first)
true