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

Merge pull request #1831 from contentfree/master

Fixes security group handling for spot instances launched into an EC2 VPC
This commit is contained in:
Wesley Beary 2013-06-14 07:03:46 -07:00
commit 95424ea23d

View file

@ -95,7 +95,7 @@ module Fog
'LaunchSpecification.KeyName' => key_name,
'LaunchSpecification.Monitoring.Enabled' => monitoring,
'LaunchSpecification.Placement.AvailabilityZone' => availability_zone,
'LaunchSpecification.SecurityGroup' => groups,
'LaunchSpecification.SecurityGroupId' => groups,
'LaunchSpecification.EbsOptimized' => ebs_optimized,
'LaunchSpecification.UserData' => user_data,
'LaunchSpecification.SubnetId' => subnet_id,
@ -106,16 +106,6 @@ module Fog
'ValidUntil' => valid_until }
options.delete_if {|key, value| value.nil?}
# If subnet is defined then this is a Virtual Private Cloud.
# subnet & security group cannot co-exist. Attempting to specify
# both subnet and groups will cause an error. Instead please make
# use of Security Group Ids when working in a VPC.
if subnet_id
options.delete('LaunchSpecification.SecurityGroup')
else
options.delete('LaunchSpecification.SubnetId')
end
data = service.request_spot_instances(image_id, flavor_id, price, options).body
spot_instance_request = data['spotInstanceRequestSet'].first
spot_instance_request['launchSpecification'].each do |name,value|