amazon-archives / aws-sdk-core-ruby

This repository has moved to the master branch of aws/aws-sdk-ruby
https://github.com/aws/aws-sdk-ruby
243 stars 57 forks source link

Resource#wait_until_running crashes #210

Closed olefriis closed 9 years ago

olefriis commented 9 years ago

Code:

require 'aws-sdk'

ec2 = Aws::EC2::Client.new(region: 'eu-west-1', credentials: Aws::Credentials.new(secret, even_more_secret))

resource = Aws::EC2::Resource.new(client: ec2)
instance = resource.create_instances(
  min_count: 1,
  max_count: 1,
  image_id: my_image_id,
  key_name: my_key_name,
  instance_type: 'm3.medium',
  security_group_ids: [my_security_group_id],
  subnet_id: my_subnet_id
).first
puts "booting..."
instance.wait_until_running

Works fine in 2.0.18.pre and previous pre-releases I've tried out.

Does not work in 2.0.19.pre all the way up to and including 2.0.22. After outputting "booting...", it seems like the script actually waits correctly for the running state, but then crashes:

booting...
/Users/olefriis/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/aws-sdk-resources-2.0.20.pre/lib/aws-sdk-resources/operations.rb:217:in `call': undefined method `data' for true:TrueClass (NoMethodError)
    from /Users/olefriis/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/aws-sdk-resources-2.0.20.pre/lib/aws-sdk-resources/operation_methods.rb:19:in `block in add_operation'
    from aws-bug.rb:16:in `<main>'
trevorrowe commented 9 years ago

Thank you for reporting this issue. This regression seems to have come from a change when upgrading from waiters v1 to waiters v2. I've patched aws-sdk-core so that Client#wait_until has the same response format as it did before the update. I will try to get this fix released tomorrow.

trevorrowe commented 9 years ago

Closed by https://github.com/aws/aws-sdk-ruby/commit/fba620dd9e8ced1e17f227edaa9b11dab953485a

olefriis commented 9 years ago

Wow, that was fast. Thanks a bunch!

trevorrowe commented 9 years ago

The fix is live now with version 2.0.23