amazon-archives/aws-sdk-core-ruby

Resource#wait_until_running crashes

Closed this issue · 4 comments

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>'

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.

Wow, that was fast. Thanks a bunch!

The fix is live now with version 2.0.23