fog-aws 1.3.0 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 507acde666f266cc70e6346a9274bcf1e1bff19c
4
- data.tar.gz: 105bb905004f27b5336ff4f17feb006164feef21
3
+ metadata.gz: 6337216d400d2563de64b38f700c73f5c35c1b9d
4
+ data.tar.gz: 014d339b4064fe6d22b6114817225778c3b131ee
5
5
  SHA512:
6
- metadata.gz: 6403c1fc64c5cc9396f4671118897c6be37aa49e88b09f8e96cdbe9f5ef68f18e087ec52a03755d53f04c4991f4616f6064e386bff3cdaa0d5dd084e7537d43e
7
- data.tar.gz: d5e45bdab2ee7dca720cc549ba6dd0202f1d9d60d98c3b2e178e36fb6910c72ac069a6197c2cf6167b8741067bc2d41280ace84430f0c2c59afe3580d1cb7f15
6
+ metadata.gz: 52648d0ea0a5f618477d8db41edf397064796c475871b857a916650c1b7d3f295dd094f286a7b5cdc7c816e57379b4d1e3545e8b2b26bd8a67561e6d4275932e
7
+ data.tar.gz: 36a0947508b7d40a7ff78b20763a84ece69d7b7b439fcc2e15d34743f99d934ed4f761d2d3971e08131f2b4e334071332096034915a197a01458895d0a7fad66
@@ -2,7 +2,29 @@
2
2
 
3
3
  ## [Unreleased](https://github.com/fog/fog-aws/tree/HEAD)
4
4
 
5
- [Full Changelog](https://github.com/fog/fog-aws/compare/v1.2.1...HEAD)
5
+ [Full Changelog](https://github.com/fog/fog-aws/compare/v1.3.0...HEAD)
6
+
7
+ **Closed issues:**
8
+
9
+ - Support REST Bucket Get v2 [\#369](https://github.com/fog/fog-aws/issues/369)
10
+ - Fog::AWS::IAM::Error: InvalidAction =\> Could not find operation "ReplaceIamInstanceProfileAssociation" for version 2010-05-08 [\#368](https://github.com/fog/fog-aws/issues/368)
11
+ - Multipart upload fails on empty files [\#364](https://github.com/fog/fog-aws/issues/364)
12
+ - The action `ModifyVolume` is not valid for this web service. [\#363](https://github.com/fog/fog-aws/issues/363)
13
+ - Tag instances upon creation of new instance [\#359](https://github.com/fog/fog-aws/issues/359)
14
+ - Cache/read local amazon data [\#354](https://github.com/fog/fog-aws/issues/354)
15
+
16
+ **Merged pull requests:**
17
+
18
+ - add NextContinuationToken support to GetBucket operation [\#370](https://github.com/fog/fog-aws/pull/370) ([khoan](https://github.com/khoan))
19
+ - Add a top-level require that matches the gem name [\#367](https://github.com/fog/fog-aws/pull/367) ([lanej](https://github.com/lanej))
20
+ - Fixed credential refresh when instance metadata host is inaccessible [\#366](https://github.com/fog/fog-aws/pull/366) ([ankane](https://github.com/ankane))
21
+ - Handle multipart upload of empty files [\#365](https://github.com/fog/fog-aws/pull/365) ([fcheung](https://github.com/fcheung))
22
+ - Add p2 instance types [\#362](https://github.com/fog/fog-aws/pull/362) ([Caged](https://github.com/Caged))
23
+ - Exponential backoff [\#361](https://github.com/fog/fog-aws/pull/361) ([VVMichaelSawyer](https://github.com/VVMichaelSawyer))
24
+ - Skip call to instance metadata host if region is specified [\#360](https://github.com/fog/fog-aws/pull/360) ([ankane](https://github.com/ankane))
25
+
26
+ ## [v1.3.0](https://github.com/fog/fog-aws/tree/v1.3.0) (2017-03-29)
27
+ [Full Changelog](https://github.com/fog/fog-aws/compare/v1.2.1...v1.3.0)
6
28
 
7
29
  **Closed issues:**
8
30
 
@@ -0,0 +1 @@
1
+ require 'fog/aws'
@@ -3,6 +3,8 @@ module Fog
3
3
  class AWS < Fog::Service
4
4
  extend Fog::AWS::CredentialFetcher::ServiceMethods
5
5
 
6
+ class RequestLimitExceeded < Fog::Errors::Error; end
7
+
6
8
  requires :aws_access_key_id, :aws_secret_access_key
7
9
  recognizes :endpoint, :region, :host, :path, :port, :scheme, :persistent, :aws_session_token, :use_iam_profile, :aws_credentials_expire_at, :instrumentor, :instrumentor_name, :version
8
10
 
@@ -537,7 +539,11 @@ module Fog
537
539
  end
538
540
  end
539
541
 
540
- def _request(body, headers, idempotent, parser)
542
+ def _request(body, headers, idempotent, parser, retries = 0)
543
+
544
+ max_retries = 10
545
+
546
+ begin
541
547
  @connection.request({
542
548
  :body => body,
543
549
  :expects => 200,
@@ -546,15 +552,24 @@ module Fog
546
552
  :method => 'POST',
547
553
  :parser => parser
548
554
  })
549
- rescue Excon::Errors::HTTPStatusError => error
550
- match = Fog::AWS::Errors.match_error(error)
551
- raise if match.empty?
552
- raise case match[:code]
555
+ rescue Excon::Errors::HTTPStatusError => error
556
+ match = Fog::AWS::Errors.match_error(error)
557
+ raise if match.empty?
558
+ raise case match[:code]
553
559
  when 'NotFound', 'Unknown'
554
560
  Fog::Compute::AWS::NotFound.slurp(error, match[:message])
561
+ when 'RequestLimitExceeded'
562
+ if retries < max_retries
563
+ sleep (2.0 ** (1.0 + retries) * 100) / 1000.0
564
+ retries += 1
565
+ retry
566
+ else
567
+ Fog::Compute::AWS::RequestLimitExceeded.slurp(error, "Max retries exceeded (#{max_retries}) #{match[:code]} => #{match[:message]}")
568
+ end
555
569
  else
556
570
  Fog::Compute::AWS::Error.slurp(error, "#{match[:code]} => #{match[:message]}")
557
571
  end
572
+ end
558
573
  end
559
574
  end
560
575
  end
@@ -16,7 +16,7 @@ module Fog
16
16
  if options[:use_iam_profile]
17
17
  begin
18
18
  role_data = nil
19
- az_data = nil
19
+ region = options[:region]
20
20
 
21
21
  if ENV["AWS_CONTAINER_CREDENTIALS_RELATIVE_URI"]
22
22
  connection = options[:connection] || Excon.new(CONTAINER_CREDENTIALS_HOST)
@@ -24,16 +24,14 @@ module Fog
24
24
  role_data = connection.get(:path => credential_path, :idempotent => true, :expects => 200).body
25
25
 
26
26
  connection = options[:metadata_connection] || Excon.new(INSTANCE_METADATA_HOST)
27
- az_data = connection.get(:path => INSTANCE_METADATA_AZ, :idempotent => true, :expects => 200).body
27
+ region ||= connection.get(:path => INSTANCE_METADATA_AZ, :idempotent => true, :expects => 200).body[0..-2]
28
28
  else
29
29
  connection = options[:connection] || Excon.new(INSTANCE_METADATA_HOST)
30
30
  role_name = connection.get(:path => INSTANCE_METADATA_PATH, :idempotent => true, :expects => 200).body
31
31
  role_data = connection.get(:path => INSTANCE_METADATA_PATH+role_name, :idempotent => true, :expects => 200).body
32
- az_data = connection.get(:path => INSTANCE_METADATA_AZ, :idempotent => true, :expects => 200).body
32
+ region ||= connection.get(:path => INSTANCE_METADATA_AZ, :idempotent => true, :expects => 200).body[0..-2]
33
33
  end
34
34
 
35
- region = az_data[0..-2] # get region from az
36
-
37
35
  session = Fog::JSON.decode(role_data)
38
36
  credentials = {}
39
37
  credentials[:aws_access_key_id] = session['AccessKeyId']
@@ -70,7 +68,7 @@ module Fog
70
68
 
71
69
  def refresh_credentials
72
70
  if @use_iam_profile
73
- new_credentials = service.fetch_credentials :use_iam_profile => @use_iam_profile
71
+ new_credentials = service.fetch_credentials :use_iam_profile => @use_iam_profile, :region => @region
74
72
  if new_credentials.any?
75
73
  setup_credentials new_credentials
76
74
  return true
@@ -683,6 +683,36 @@ module Fog
683
683
  :disk => 0,
684
684
  :ebs_optimized_available => true,
685
685
  :instance_store_volumes => 0
686
+ },
687
+ {
688
+ :id => "p2.xlarge",
689
+ :name => "General Purpose GPU Extra Large",
690
+ :bits => 64,
691
+ :cores => 2496,
692
+ :ram => 65498,
693
+ :disk => 0,
694
+ :ebs_optimized_available => true,
695
+ :instance_store_volumes => 0
696
+ },
697
+ {
698
+ :id => "p2.8xlarge",
699
+ :name => "General Purpose GPU Eight Extra Large",
700
+ :bits => 64,
701
+ :cores => 19968,
702
+ :ram => 523986,
703
+ :disk => 0,
704
+ :ebs_optimized_available => true,
705
+ :instance_store_volumes => 0
706
+ },
707
+ {
708
+ :id => "p2.16xlarge",
709
+ :name => "General Purpose GPU Sixteen Extra Large",
710
+ :bits => 64,
711
+ :cores => 39936,
712
+ :ram => 785979,
713
+ :disk => 0,
714
+ :ebs_optimized_available => true,
715
+ :instance_store_volumes => 0
686
716
  }
687
717
  ]
688
718
 
@@ -276,6 +276,11 @@ module Fog
276
276
  part_tags << part_upload.headers["ETag"]
277
277
  end
278
278
 
279
+ if part_tags.empty? #it is an error to have a multipart upload with no parts
280
+ part_upload = service.upload_part(directory.key, key, upload_id, 1, '', part_headers('', options))
281
+ part_tags << part_upload.headers["ETag"]
282
+ end
283
+
279
284
  rescue
280
285
  # Abort the upload & reraise
281
286
  service.abort_multipart_upload(directory.key, key, upload_id) if upload_id
@@ -35,7 +35,7 @@ module Fog
35
35
  end
36
36
  when 'LastModified'
37
37
  @object['LastModified'] = Time.parse(value)
38
- when 'Marker', 'Name'
38
+ when 'Marker', 'Name', 'NextContinuationToken'
39
39
  @response[name] = value
40
40
  when 'MaxKeys'
41
41
  @response['MaxKeys'] = value.to_i
@@ -1,5 +1,5 @@
1
1
  module Fog
2
2
  module AWS
3
- VERSION = "1.3.0"
3
+ VERSION = "1.4.0"
4
4
  end
5
5
  end
@@ -74,6 +74,18 @@ Shindo.tests("Storage[:aws] | file", ["aws"]) do
74
74
 
75
75
  end
76
76
 
77
+ tests("multipart upload with empty file") do
78
+ pending if Fog.mocking?
79
+
80
+ @empty_file = Tempfile.new("fog-test-aws-s3-multipart-empty")
81
+
82
+ tests("#save(:multipart_chunk_size => 5242880)").succeeds do
83
+ @directory.files.create(:key => 'empty-multipart-upload', :body => @empty_file, :multipart_chunk_size => 5242880)
84
+ end
85
+
86
+ @empty_file.close
87
+ end
88
+
77
89
  tests("multipart upload with customer encryption").returns(true) do
78
90
  pending if Fog.mocking?
79
91
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fog-aws
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Lane
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-03-29 00:00:00.000000000 Z
12
+ date: 2017-06-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -147,6 +147,7 @@ files:
147
147
  - gemfiles/Gemfile-ruby-1.8.7
148
148
  - gemfiles/Gemfile-ruby-1.9
149
149
  - gemfiles/Gemfile-ruby-2.0
150
+ - lib/fog-aws.rb
150
151
  - lib/fog/aws.rb
151
152
  - lib/fog/aws/auto_scaling.rb
152
153
  - lib/fog/aws/beanstalk.rb
@@ -1698,7 +1699,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1698
1699
  version: '0'
1699
1700
  requirements: []
1700
1701
  rubyforge_project:
1701
- rubygems_version: 2.5.2
1702
+ rubygems_version: 2.6.12
1702
1703
  signing_key:
1703
1704
  specification_version: 4
1704
1705
  summary: Module for the 'fog' gem to support Amazon Web Services.