fog / fog-openstack

Fog for OpenStack Platform
MIT License
68 stars 130 forks source link

Glance v2 image api's private/public method error #244

Open zhoutiekui opened 7 years ago

zhoutiekui commented 7 years ago

The test code: p @imageService.images.public

Error as below: Error: test_cinder_backups_all(Debug): NoMethodError: undefined method is_public' for <Fog::Image::OpenStack::V2::Image:0x000000035002c8> C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/fog-openstack-0.1.17/lib/fog/image/openstack/v2/models/image.rb:52:inmethod_missing' C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/fog-openstack-0.1.17/lib/fog/image/openstack/v2/models/images.rb:27:in block in public' C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/fog-core-1.43.0/lib/fog/core/collection.rb:19:indelete_if' C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/fog-core-1.43.0/lib/fog/core/collection.rb:19:in delete_if' C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/fog-openstack-0.1.17/lib/fog/image/openstack/v2/models/images.rb:27:inpublic' Debug.rb:58:in `test_cinder_backups_all' 55: #p @imageService.images.all 56: #p @imageService.images.summary 57: # p @imageService.images.private => 58: p @imageService.images.public 59: end 60:
61:

Anybody who knows the reason,thanks.

Carthaca commented 7 years ago

good point, it is most likely a copy & paste error here: https://github.com/fog/fog-openstack/blob/master/lib/fog/image/openstack/v2/models/images.rb#L29

is_public is a v1 method, this should use visibility instead

If you would like to provide a fixing pull request, I'm happy to review.

shaneboulden commented 7 years ago

Hey, I created a PR here for this issue. Appreciate any feedback: https://github.com/fog/fog-openstack/pull/282