mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Merge pull request #2173 from burns/remove_deprecated_block_os
[openstack|storage] remove deprecated response block from request
This commit is contained in:
commit
f87416f91d
2 changed files with 10 additions and 10 deletions
|
@ -10,17 +10,17 @@ module Fog
|
||||||
# * object<~String> - Name of object to look for
|
# * object<~String> - Name of object to look for
|
||||||
#
|
#
|
||||||
def get_object(container, object, &block)
|
def get_object(container, object, &block)
|
||||||
params = {}
|
params = {
|
||||||
|
|
||||||
if block_given?
|
|
||||||
params[:response_block] = Proc.new
|
|
||||||
end
|
|
||||||
|
|
||||||
request(params.merge!({
|
|
||||||
:expects => 200,
|
:expects => 200,
|
||||||
:method => 'GET',
|
:method => 'GET',
|
||||||
:path => "#{Fog::OpenStack.escape(container)}/#{Fog::OpenStack.escape(object)}"
|
:path => "#{Fog::OpenStack.escape(container)}/#{Fog::OpenStack.escape(object)}"
|
||||||
}), false)
|
}
|
||||||
|
|
||||||
|
if block_given?
|
||||||
|
params[:response_block] = block
|
||||||
|
end
|
||||||
|
|
||||||
|
request(params, false)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -140,7 +140,7 @@ module Fog
|
||||||
@path = @original_path
|
@path = @original_path
|
||||||
end
|
end
|
||||||
|
|
||||||
def request(params, parse_json = true, &block)
|
def request(params, parse_json = true)
|
||||||
begin
|
begin
|
||||||
response = @connection.request(params.merge({
|
response = @connection.request(params.merge({
|
||||||
:headers => {
|
:headers => {
|
||||||
|
@ -149,7 +149,7 @@ module Fog
|
||||||
}.merge!(params[:headers] || {}),
|
}.merge!(params[:headers] || {}),
|
||||||
:host => @host,
|
:host => @host,
|
||||||
:path => "#{@path}/#{params[:path]}",
|
:path => "#{@path}/#{params[:path]}",
|
||||||
}), &block)
|
}))
|
||||||
rescue Excon::Errors::Unauthorized => error
|
rescue Excon::Errors::Unauthorized => error
|
||||||
if error.response.body != 'Bad username or password' # token expiration
|
if error.response.body != 'Bad username or password' # token expiration
|
||||||
@openstack_must_reauthenticate = true
|
@openstack_must_reauthenticate = true
|
||||||
|
|
Loading…
Reference in a new issue