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.Value', tags.values))
|
||||
request({
|
||||
'Action' => 'CreateTags',
|
||||
'Action' => 'DeleteTags',
|
||||
:parser => Fog::Parsers::AWS::Compute::Basic.new
|
||||
}.merge!(params))
|
||||
end
|
||||
|
|
|
@ -337,20 +337,19 @@ DATA
|
|||
signature = Base64.encode64(signed_string).chomp!
|
||||
end
|
||||
|
||||
|
||||
private
|
||||
|
||||
def request(params, &block)
|
||||
params[:headers]['Date'] = Fog::Time.now.to_date_header
|
||||
params[:headers]['Authorization'] = "AWS #{@aws_access_key_id}:#{signature(params)}"
|
||||
params[:expects] = [307, *params[:expects]].flatten
|
||||
|
||||
# FIXME: ToHashParser should make this not needed
|
||||
original_params = params.dup
|
||||
|
||||
response = @connection.request(params, &block)
|
||||
|
||||
if response.status == 307
|
||||
uri = URI.parse(response.headers['Location'])
|
||||
begin
|
||||
response = @connection.request(params, &block)
|
||||
rescue Excon::Errors::TemporaryRedirect => error
|
||||
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[/]")
|
||||
response = Fog::Connection.new("#{@scheme}://#{uri.host}:#{@port}", false).request(original_params, &block)
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue