fog / fog-google

Fog for Google Cloud Platform
MIT License
98 stars 146 forks source link

instance_groups.all() fails with TypeError: no implicit conversion of String into Integer #115

Closed areznikov-kabam closed 8 years ago

areznikov-kabam commented 8 years ago

fog-google 0.2.0 google-api-client 0.8.6 RUBY_VERSION "2.0.0"

instance_groups.all() fails with the following error

>> gce.instance_groups.all()
Exception `OpenSSL::SSL::SSLError' at /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/openssl/buffering.rb:175 - read would block
Exception `OpenSSL::SSL::SSLError' at /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/openssl/buffering.rb:175 - read would block
Exception `TypeError' at /Library/Ruby/Gems/2.0.0/gems/fog-google-0.2.0/lib/fog/compute/google/models/instance_groups.rb:17 - no implicit conversion of String into Integer
Exception `TypeError' at /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/irb/workspace.rb:86 - no implicit conversion of String into Integer
TypeError: no implicit conversion of String into Integer
    from /Library/Ruby/Gems/2.0.0/gems/fog-google-0.2.0/lib/fog/compute/google/models/instance_groups.rb:17:in `[]'
    from /Library/Ruby/Gems/2.0.0/gems/fog-google-0.2.0/lib/fog/compute/google/models/instance_groups.rb:17:in `all'
    from (irb):118
    from /usr/bin/irb:12:in `<main>'
areznikov-kabam commented 8 years ago

I've fixed it by changing one line

17c17
<           load(data)
---
>           load(data["items"])

Anyway lib/fog/compute/google/models/instance_groups.rb seems to me a little bit wrong

def add_instance(params)
def remove_instance(params)
def get_instances(params)

should be moved to lib/fog/compute/google/models/instance_group.rb following my understanding and improved to something similar to lib/fog/compute/google/models/target_pool.rb

Temikus commented 8 years ago

Fixed by #133 Thanks for submitting this, @areznikov-kabam! 🎉