diff --git a/lib/fog/openstack/models/compute/server.rb b/lib/fog/openstack/models/compute/server.rb index da03efa13..be064dfbb 100644 --- a/lib/fog/openstack/models/compute/server.rb +++ b/lib/fog/openstack/models/compute/server.rb @@ -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}) diff --git a/lib/fog/openstack/models/orchestration/stack.rb b/lib/fog/openstack/models/orchestration/stack.rb index 450a1ebf1..649b3dd90 100644 --- a/lib/fog/openstack/models/orchestration/stack.rb +++ b/lib/fog/openstack/models/orchestration/stack.rb @@ -45,7 +45,7 @@ module Fog end def resources(options={}) - @resources ||= service.resources.all(self, options) + @resources ||= service.resources.all({:stack => self}.merge(options)) end def events(options={}) diff --git a/lib/fog/openstack/requests/compute/list_security_groups.rb b/lib/fog/openstack/requests/compute/list_security_groups.rb index 5c740f473..1fc7d1710 100644 --- a/lib/fog/openstack/requests/compute/list_security_groups.rb +++ b/lib/fog/openstack/requests/compute/list_security_groups.rb @@ -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