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

fix security group stuff for instances

This commit is contained in:
Wesley Beary 2010-01-21 20:11:14 -08:00
parent 47c53e06b0
commit 0fe074dae1
2 changed files with 9 additions and 4 deletions

View file

@ -9,7 +9,7 @@ module Fog
attribute :ami_launch_index, 'amiLaunchIndex' attribute :ami_launch_index, 'amiLaunchIndex'
attribute :availability_zone, 'availabilityZone' attribute :availability_zone, 'availabilityZone'
attribute :dns_name, 'dnsName' attribute :dns_name, 'dnsName'
attribute :group_id, 'groupId' attribute :groups
attribute :image_id, 'imageId' attribute :image_id, 'imageId'
attribute :state, 'instanceState' attribute :state, 'instanceState'
attribute :flavor_id, 'instanceType' attribute :flavor_id, 'instanceType'
@ -23,6 +23,11 @@ module Fog
attribute :reason attribute :reason
attribute :user_data attribute :user_data
def initialize(attributes)
@groups ||= []
super
end
def addresses def addresses
requires :id requires :id
@ -99,8 +104,8 @@ module Fog
if @availability_zone if @availability_zone
options['Placement.AvailabilityZone'] = @availability_zone options['Placement.AvailabilityZone'] = @availability_zone
end end
if @group_id unless @groups.empty?
options['SecurityGroup'] = @group_id options['SecurityGroup'] = @groups.first
end end
if @kernel_id if @kernel_id
options['KernelId'] = @kernel_id options['KernelId'] = @kernel_id

View file

@ -26,7 +26,7 @@ module Fog
data = connection.describe_instances(server_id).body data = connection.describe_instances(server_id).body
data['reservationSet'].each do |reservation| data['reservationSet'].each do |reservation|
reservation['instancesSet'].each do |instance| reservation['instancesSet'].each do |instance|
self << new(instance) self << new(instance.merge(:groups => reservation['groupSet']))
end end
end end
self self