diff --git a/lib/fog/openstack/requests/storage/get_object.rb b/lib/fog/openstack/requests/storage/get_object.rb index 1f57c3f28..451510330 100644 --- a/lib/fog/openstack/requests/storage/get_object.rb +++ b/lib/fog/openstack/requests/storage/get_object.rb @@ -10,17 +10,17 @@ module Fog # * object<~String> - Name of object to look for # def get_object(container, object, &block) - params = {} - - if block_given? - params[:response_block] = Proc.new - end - - request(params.merge!({ + params = { :expects => 200, :method => 'GET', :path => "#{Fog::OpenStack.escape(container)}/#{Fog::OpenStack.escape(object)}" - }), false) + } + + if block_given? + params[:response_block] = block + end + + request(params, false) end end diff --git a/lib/fog/openstack/storage.rb b/lib/fog/openstack/storage.rb index a38f95b60..4fc2b7d81 100644 --- a/lib/fog/openstack/storage.rb +++ b/lib/fog/openstack/storage.rb @@ -140,7 +140,7 @@ module Fog @path = @original_path end - def request(params, parse_json = true, &block) + def request(params, parse_json = true) begin response = @connection.request(params.merge({ :headers => { @@ -149,7 +149,7 @@ module Fog }.merge!(params[:headers] || {}), :host => @host, :path => "#{@path}/#{params[:path]}", - }), &block) + })) rescue Excon::Errors::Unauthorized => error if error.response.body != 'Bad username or password' # token expiration @openstack_must_reauthenticate = true