From 592758492d822e5e3a600c1adf651a78ca35ce3c Mon Sep 17 00:00:00 2001 From: Greg Blomquist Date: Thu, 27 Aug 2015 18:17:50 -0400 Subject: [PATCH 1/2] 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 --- lib/fog/openstack/models/compute/server.rb | 2 +- .../openstack/requests/compute/list_security_groups.rb | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) 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/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 From 2e4ec4770c996f0d074727a85772d5b01848bbae Mon Sep 17 00:00:00 2001 From: Greg Blomquist Date: Thu, 27 Aug 2015 18:24:56 -0400 Subject: [PATCH 2/2] Fix deprecated call to resources As the deprecation warning suggests: > Calling OpenStack[:orchestration].list_resources(stack, options) is > deprecated, call .list_resources(:stack => stack) or > .list_resources(:stack_name => value, :stack_id => value) instead --- lib/fog/openstack/models/orchestration/stack.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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={})