1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

Fix deprecated call to security_groups

As the deprecation warning suggests:

> Calling OpenStack[:compute].list_security_groups(server_id) is deprecated, use
> .list_security_groups(:server_id => value) instead
This commit is contained in:
Greg Blomquist 2015-08-27 18:17:50 -04:00
parent 82e2233311
commit 592758492d
2 changed files with 10 additions and 2 deletions

View file

@ -212,7 +212,7 @@ module Fog
def security_groups
requires :id
groups = service.list_security_groups(id).body['security_groups']
groups = service.list_security_groups(:server_id => id).body['security_groups']
groups.map do |group|
Fog::Compute::OpenStack::SecurityGroup.new group.merge({:service => service})

View file

@ -29,7 +29,15 @@ module Fog
end
class Mock
def list_security_groups(server_id = nil)
def list_security_groups(options = {})
if options.is_a?(Hash)
server_id = options.delete(:server_id)
query = options
else
server_id = options
query = {}
end
security_groups = self.data[:security_groups].values
groups = if server_id then