mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Merge branch 'master' of github.com:geemus/fog
This commit is contained in:
commit
82d3fc95f4
2 changed files with 6 additions and 7 deletions
|
@ -26,7 +26,7 @@ module Fog
|
||||||
params.merge!(AWS.indexed_param('Tag.%d.Key', tags.keys))
|
params.merge!(AWS.indexed_param('Tag.%d.Key', tags.keys))
|
||||||
params.merge!(AWS.indexed_param('Tag.%d.Value', tags.values))
|
params.merge!(AWS.indexed_param('Tag.%d.Value', tags.values))
|
||||||
request({
|
request({
|
||||||
'Action' => 'CreateTags',
|
'Action' => 'DeleteTags',
|
||||||
:parser => Fog::Parsers::AWS::Compute::Basic.new
|
:parser => Fog::Parsers::AWS::Compute::Basic.new
|
||||||
}.merge!(params))
|
}.merge!(params))
|
||||||
end
|
end
|
||||||
|
|
|
@ -337,20 +337,19 @@ DATA
|
||||||
signature = Base64.encode64(signed_string).chomp!
|
signature = Base64.encode64(signed_string).chomp!
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def request(params, &block)
|
def request(params, &block)
|
||||||
params[:headers]['Date'] = Fog::Time.now.to_date_header
|
params[:headers]['Date'] = Fog::Time.now.to_date_header
|
||||||
params[:headers]['Authorization'] = "AWS #{@aws_access_key_id}:#{signature(params)}"
|
params[:headers]['Authorization'] = "AWS #{@aws_access_key_id}:#{signature(params)}"
|
||||||
params[:expects] = [307, *params[:expects]].flatten
|
|
||||||
# FIXME: ToHashParser should make this not needed
|
# FIXME: ToHashParser should make this not needed
|
||||||
original_params = params.dup
|
original_params = params.dup
|
||||||
|
|
||||||
response = @connection.request(params, &block)
|
begin
|
||||||
|
response = @connection.request(params, &block)
|
||||||
if response.status == 307
|
rescue Excon::Errors::TemporaryRedirect => error
|
||||||
uri = URI.parse(response.headers['Location'])
|
uri = URI.parse(error.response.headers['Location'])
|
||||||
Formatador.display_line("[yellow][WARN] fog: followed redirect to #{uri.host}, connecting to the matching region will be more performant[/]")
|
Formatador.display_line("[yellow][WARN] fog: followed redirect to #{uri.host}, connecting to the matching region will be more performant[/]")
|
||||||
response = Fog::Connection.new("#{@scheme}://#{uri.host}:#{@port}", false).request(original_params, &block)
|
response = Fog::Connection.new("#{@scheme}://#{uri.host}:#{@port}", false).request(original_params, &block)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue