[aws][auto_scaling] Bug fixed: configurations.get(launch-configuration) always shows the first element #779

Merged
merged 3 commits into from Mar 6, 2012

Conversation

Projects
None yet
2 participants

Below is the proof of the bug, the original code didn't take into account that you can query one or many passing an array.

[agifog] fog
Welcome to fog interactive!
:default provides AWS

Fog.mock!
true

?> def as
@as ||= Fog::AWS::AutoScaling.new
end
nil

?> def compute
@compute ||= Fog::Compute::AWS.new
end
nil

?> @image = compute.register_image('image', 'image', '/dev/sda1').body
{"requestId"=>"cff532df-ae60-49e6-ba21-ffe46e3d4155", "imageId"=>"ami-6471279a"}
@image_id = @image['imageId']
"ami-6471279a"

?> first = as.configurations.create(:id => "first-configuration", :image_id => @image_id, :instance_type => 't1.micro')
<Fog::AWS::AutoScaling::Configuration
id="first-configuration",
arn="arn:aws:autoscaling:eu-west-1:000000000000:launchConfiguration:00000000-0000-0000-0000-000000000000:launchConfigurationName/first-configuration",
block_device_mappings=[],
created_at=2012-03-06 14:04:10 UTC,
image_id="ami-6471279a",
instance_monitoring=true,
instance_type="t1.micro",
kernel_id=nil,
key_name=nil,
ramdisk_id=nil,
security_groups=[],
user_data=nil

second = as.configurations.create(:id => "second-configuration", :image_id => @image_id, :instance_type => 't1.micro')
<Fog::AWS::AutoScaling::Configuration
id="first-configuration",
arn="arn:aws:autoscaling:eu-west-1:000000000000:launchConfiguration:00000000-0000-0000-0000-000000000000:launchConfigurationName/first-configuration",
block_device_mappings=[],
created_at=2012-03-06 14:04:10 UTC,
image_id="ami-6471279a",
instance_monitoring=true,
instance_type="t1.micro",
kernel_id=nil,
key_name=nil,
ramdisk_id=nil,
security_groups=[],
user_data=nil

as.configurations.get('second-configuration')
<Fog::AWS::AutoScaling::Configuration
id="first-configuration",
arn="arn:aws:autoscaling:eu-west-1:000000000000:launchConfiguration:00000000-0000-0000-0000-000000000000:launchConfigurationName/first-configuration",
block_device_mappings=[],
created_at=2012-03-06 14:04:10 UTC,
image_id="ami-6471279a",
instance_monitoring=true,
instance_type="t1.micro",
kernel_id=nil,
key_name=nil,
ramdisk_id=nil,
security_groups=[],
user_data=nil

I've also added support for delete_launch_configuration mocking

Owner

geemus commented Mar 6, 2012

@restebanez awesome, thanks!

@geemus geemus added a commit that referenced this pull request Mar 6, 2012

@geemus geemus Merge pull request #779 from restebanez/auto_scaling_configuration_ge…
…t_bug_fixed

[aws][auto_scaling] Bug fixed: configurations.get(launch-configuration) always shows the first element
ed8d43e

@geemus geemus merged commit ed8d43e into fog:master Mar 6, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment