[aws|compute] fixes to make clientToken work properly throughout

This commit is contained in:
geemus 2010-10-04 16:27:32 -07:00
parent b6ae71066f
commit cf724053a0
5 changed files with 12 additions and 10 deletions

View File

@ -34,10 +34,10 @@ module Fog
@instance[name] = @value.to_i
when 'availabilityZone'
@instance['placement'][name] = @value
when 'architecture', 'clientToken', 'dnsName', 'imageId', 'instanceId',
'instanceType', 'ipAddress', 'kernelId', 'keyName',
'privateDnsName', 'privateIpAddress', 'ramdiskId', 'reason',
'rootDeviceType'
when 'architecture', 'clientToken', 'dnsName', 'imageId',
'instanceId', 'instanceType', 'ipAddress', 'kernelId',
'keyName', 'privateDnsName', 'privateIpAddress', 'ramdiskId',
'reason', 'rootDeviceType'
@instance[name] = @value
when 'attachTime'
@block_device_mapping[name] = Time.parse(@value)

View File

@ -27,10 +27,10 @@ module Fog
case name
when 'amiLaunchIndex'
@instance[name] = @value.to_i
when 'architecture', 'dnsName', 'imageId', 'instanceId',
'instanceType', 'ipAddress', 'kernelId', 'keyName',
'privateDnsName', 'privateIpAddress', 'ramdiskId', 'reason',
'rootDeviceType'
when 'architecture', 'clientToken', 'dnsName', 'imageId',
'instanceId', 'instanceType', 'ipAddress', 'kernelId',
'keyName', 'privateDnsName', 'privateIpAddress', 'ramdiskId',
'reason', 'rootDeviceType'
@instance[name] = @value
when 'availabilityZone'
@instance['placement'][name] = @value

View File

@ -179,7 +179,7 @@ module Fog
'ownerId' => instance['ownerId'],
'reservationId' => instance['reservationId']
}
reservation_set[instance['reservationId']]['instancesSet'] << instance.reject{|key,value| !['amiLaunchIndex', 'architecture', 'blockDeviceMapping', 'dnsName', 'imageId', 'instanceId', 'instanceState', 'instanceType', 'ipAddress', 'kernelId', 'keyName', 'launchTime', 'monitoring', 'placement', 'privateDnsName', 'privateIpAddress', 'productCodes', 'ramdiskId', 'reason', 'rootDeviceType'].include?(key)}
reservation_set[instance['reservationId']]['instancesSet'] << instance.reject{|key,value| !['amiLaunchIndex', 'architecture', 'blockDeviceMapping', 'clientToken', 'dnsName', 'imageId', 'instanceId', 'instanceState', 'instanceType', 'ipAddress', 'kernelId', 'keyName', 'launchTime', 'monitoring', 'placement', 'privateDnsName', 'privateIpAddress', 'productCodes', 'ramdiskId', 'reason', 'rootDeviceType'].include?(key)}
end
end

View File

@ -94,7 +94,7 @@ module Fog
options['UserData'] = Base64.encode64(options['UserData'])
end
idempotent = !options['ClientToken'].empty?
idempotent = options['ClientToken'].nil? || options['ClientToken'].empty?
request({
'Action' => 'RunInstances',
@ -123,6 +123,7 @@ module Fog
instance = {
'amiLaunchIndex' => i,
'blockDeviceMapping' => [],
'clientToken' => options['clientToken'],
'dnsName' => nil,
'imageId' => image_id,
'instanceId' => instance_id,

View File

@ -4,6 +4,7 @@ Shindo.tests('AWS::Compute | instance requests', ['aws']) do
# 'architecture' => String,
'amiLaunchIndex' => Integer,
'blockDeviceMapping' => [],
'clientToken' => NilClass,
'dnsName' => NilClass,
'imageId' => String,
'instanceId' => String,