fog-aws 0.9.3 → 0.9.4

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: 0361bb136f825209f65c1e570b023e6f2b74d865
4
- data.tar.gz: 043f9727f53b0c68c6648bac38bf35bb13354590
3
+ metadata.gz: 77eaa59f1f6bf9034200ca58a0927a7da17cbf33
4
+ data.tar.gz: 39ba1b65e37c525620fe03f5794113f17215a2e7
5
5
  SHA512:
6
- metadata.gz: 89aa0ad3aadc59b08fd8e5969cefc1b4afa9cc04297836406139fdb47ecb2aa2c2ea6a3e330bca0de37942c46c01d23467a402df2e1a961084d838858af3bb30
7
- data.tar.gz: 2f5414ddd22a1a99bcfc16b0deb5aef69f632ee4e04b754a7693d412f2b226a1cea3c0bcd7e40533560a3b89d2b2f9879ab2f86c3c1faeb00d0b235b4746bba1
6
+ metadata.gz: 92b1b41b56eb738ccd414a8829897c37c4d5a0bcfaeec4b45f4df24cf2d2ae63cf8616ccd9af9afc43cb910a220360d68ac6e7cb3f9138a545a953a4b29864cf
7
+ data.tar.gz: c8b7b3d026f41cfac0f3f7746465cc48d60cd7287e39c10c3dc61ca03fa58051a8c8ec5d84e0adf7ae96ae76a126a195f12d5f89e569a7e9a39c79b202be2d09
@@ -2,7 +2,21 @@
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/v0.9.2...HEAD)
5
+ [Full Changelog](https://github.com/fog/fog-aws/compare/v0.9.3...HEAD)
6
+
7
+ **Closed issues:**
8
+
9
+ - S3: retry on 503 Service Unavailable [\#265](https://github.com/fog/fog-aws/issues/265)
10
+ - Digest::Base Error [\#261](https://github.com/fog/fog-aws/issues/261)
11
+
12
+ **Merged pull requests:**
13
+
14
+ - Updated Region 'Mumbai' ap-south-1 [\#267](https://github.com/fog/fog-aws/pull/267) ([chanakyacool](https://github.com/chanakyacool))
15
+ - Replaces usage of Digest with OpenSSL::Digest [\#266](https://github.com/fog/fog-aws/pull/266) ([esthervillars](https://github.com/esthervillars))
16
+ - AWS DNS - support newer DNS hosted zone IDs for dualstack ELBs [\#263](https://github.com/fog/fog-aws/pull/263) ([mattheworiordan](https://github.com/mattheworiordan))
17
+
18
+ ## [v0.9.3](https://github.com/fog/fog-aws/tree/v0.9.3) (2016-06-20)
19
+ [Full Changelog](https://github.com/fog/fog-aws/compare/v0.9.2...v0.9.3)
6
20
 
7
21
  **Closed issues:**
8
22
 
@@ -224,7 +224,7 @@ module Fog
224
224
  end
225
225
 
226
226
  def self.regions
227
- @regions ||= ['ap-northeast-1', 'ap-northeast-2', 'ap-southeast-1', 'ap-southeast-2', 'eu-central-1', 'eu-west-1', 'us-east-1', 'us-west-1', 'us-west-2', 'sa-east-1', 'cn-north-1', 'us-gov-west-1']
227
+ @regions ||= ['ap-northeast-1', 'ap-northeast-2', 'ap-southeast-1', 'ap-southeast-2', 'eu-central-1', 'eu-west-1', 'us-east-1', 'us-west-1', 'us-west-2', 'sa-east-1', 'cn-north-1', 'us-gov-west-1', 'ap-south-1']
228
228
  end
229
229
 
230
230
  def self.validate_region!(region, host=nil)
@@ -43,7 +43,7 @@ module Fog
43
43
  while digests.length > 1
44
44
  digests = digests.each_slice(2).map do |pair|
45
45
  if pair.length == 2
46
- Digest::SHA256.digest(pair[0]+pair[1])
46
+ OpenSSL::Digest::SHA256.digest(pair[0]+pair[1])
47
47
  else
48
48
  pair.first
49
49
  end
@@ -65,13 +65,13 @@ module Fog
65
65
  def digest_for_part(body)
66
66
  chunk_count = [body.bytesize / MEGABYTE + (body.bytesize % MEGABYTE > 0 ? 1 : 0), 1].max
67
67
  if body.respond_to? :byteslice
68
- digests_for_part = chunk_count.times.map {|chunk_index| Digest::SHA256.digest(body.byteslice(chunk_index * MEGABYTE, MEGABYTE))}
68
+ digests_for_part = chunk_count.times.map {|chunk_index| OpenSSL::Digest::SHA256.digest(body.byteslice(chunk_index * MEGABYTE, MEGABYTE))}
69
69
  else
70
70
  if body.respond_to? :encoding
71
71
  old_encoding = body.encoding
72
72
  body.force_encoding('BINARY')
73
73
  end
74
- digests_for_part = chunk_count.times.map {|chunk_index| Digest::SHA256.digest(body.slice(chunk_index * MEGABYTE, MEGABYTE))}
74
+ digests_for_part = chunk_count.times.map {|chunk_index| OpenSSL::Digest::SHA256.digest(body.slice(chunk_index * MEGABYTE, MEGABYTE))}
75
75
  if body.respond_to? :encoding
76
76
  body.force_encoding(old_encoding)
77
77
  end
@@ -289,7 +289,7 @@ module Fog
289
289
  end
290
290
 
291
291
  def part_headers(chunk, options)
292
- md5 = Base64.encode64(Digest::MD5.digest(chunk)).strip
292
+ md5 = Base64.encode64(OpenSSL::Digest::MD5.digest(chunk)).strip
293
293
  encryption_keys = encryption_customer_key_headers.keys
294
294
  encryption_headers = options.select { |key| encryption_keys.include?(key) }
295
295
  { 'Content-MD5' => md5 }.merge(encryption_headers)
@@ -299,7 +299,7 @@ module Fog
299
299
  {
300
300
  'x-amz-server-side-encryption-customer-algorithm' => encryption,
301
301
  'x-amz-server-side-encryption-customer-key' => Base64.encode64(encryption_key.to_s).chomp!,
302
- 'x-amz-server-side-encryption-customer-key-md5' => Base64.encode64(Digest::MD5.digest(encryption_key.to_s)).chomp!
302
+ 'x-amz-server-side-encryption-customer-key-md5' => Base64.encode64(OpenSSL::Digest::MD5.digest(encryption_key.to_s)).chomp!
303
303
  }
304
304
  end
305
305
  end
@@ -77,6 +77,9 @@ module Fog
77
77
 
78
78
  {"messageSet" => [], "regionName" => "ap-southeast-2", "zoneName" => "ap-southeast-2a", "zoneState" => "available"},
79
79
  {"messageSet" => [], "regionName" => "ap-southeast-2", "zoneName" => "ap-southeast-2b", "zoneState" => "available"},
80
+
81
+ {"messageSet" => [], "regionName" => "ap-south-1", "zoneName" => "ap-south-1a", "zoneState" => "available"},
82
+ {"messageSet" => [], "regionName" => "ap-south-1", "zoneName" => "ap-south-1b", "zoneState" => "available"},
80
83
  ]
81
84
 
82
85
  availability_zone_info = all_zones.select { |zoneinfo| zoneinfo["regionName"] == @region }
@@ -3,7 +3,13 @@ module Fog
3
3
  class AWS
4
4
 
5
5
  def self.hosted_zone_for_alias_target(dns_name)
6
- Hash[elb_hosted_zone_mapping.select { |k, _|
6
+ hosted_zones = if dns_name.match(/^dualstack\./)
7
+ elb_dualstack_hosted_zone_mapping
8
+ else
9
+ elb_hosted_zone_mapping
10
+ end
11
+
12
+ Hash[hosted_zones.select { |k, _|
7
13
  dns_name =~ /\A.+\.#{k}\.elb\.amazonaws\.com\.?\z/
8
14
  }].values.last
9
15
  end
@@ -22,6 +28,21 @@ module Fog
22
28
  }
23
29
  end
24
30
 
31
+ # See https://forums.aws.amazon.com/message.jspa?messageID=612414
32
+ def self.elb_dualstack_hosted_zone_mapping
33
+ @elb_dualstack_hosted_zone_mapping ||= {
34
+ "ap-northeast-1" => "Z14GRHDCWA56QT",
35
+ "ap-southeast-1" => "Z1LMS91P8CMLE5",
36
+ "ap-southeast-2" => "Z1GM3OXH4ZPM65",
37
+ "eu-central-1" => "Z215JYRZR1TBD5",
38
+ "eu-west-1" => "Z32O12XQLNTSW2",
39
+ "sa-east-1" => "Z2P70J7HTTTPLU",
40
+ "us-east-1" => "Z35SXDOTRQ7X7K",
41
+ "us-west-1" => "Z368ELLRRE2KJ0",
42
+ "us-west-2" => "Z1H1FL5HABSF5",
43
+ }
44
+ end
45
+
25
46
  # Returns the xml request for a given changeset
26
47
  def self.change_resource_record_sets_data(zone_id, change_batch, version, options = {})
27
48
  # AWS methods return zone_ids that looks like '/hostedzone/id'. Let the caller either use
@@ -22,7 +22,7 @@ module Fog
22
22
 
23
23
  headers = {
24
24
  'Content-Length' => body.bytesize.to_s,
25
- 'x-amz-content-sha256' => Digest::SHA256.hexdigest(body),
25
+ 'x-amz-content-sha256' => OpenSSL::Digest::SHA256.hexdigest(body),
26
26
  'x-amz-sha256-tree-hash' => Fog::AWS::Glacier::TreeHash.digest(body)
27
27
  }
28
28
  headers['x-amz-archive-description'] = Fog::AWS.escape(options['description']) if options['description']
@@ -25,7 +25,7 @@ module Fog
25
25
  headers = {
26
26
  'Content-Length' => body.bytesize.to_s,
27
27
  'Content-Range' => "bytes #{offset}-#{offset+body.bytesize-1}/*",
28
- 'x-amz-content-sha256' => Digest::SHA256.hexdigest(body),
28
+ 'x-amz-content-sha256' => OpenSSL::Digest::SHA256.hexdigest(body),
29
29
  'x-amz-sha256-tree-hash' => hash
30
30
  }
31
31
 
@@ -32,7 +32,7 @@ module Fog
32
32
 
33
33
  now = Time.now
34
34
  message_id = Fog::AWS::Mock.sqs_message_id
35
- md5 = Digest::MD5.hexdigest(message)
35
+ md5 = OpenSSL::Digest::MD5.hexdigest(message)
36
36
 
37
37
  queue[:messages][message_id] = {
38
38
  'MessageId' => message_id,
@@ -47,7 +47,7 @@ module Fog
47
47
  data << "</Delete>"
48
48
 
49
49
  headers['Content-Length'] = data.length
50
- headers['Content-MD5'] = Base64.encode64(Digest::MD5.digest(data)).
50
+ headers['Content-MD5'] = Base64.encode64(OpenSSL::Digest::MD5.digest(data)).
51
51
  gsub("\n", '')
52
52
 
53
53
  request({
@@ -22,7 +22,7 @@ module Fog
22
22
  data = '<RestoreRequest xmlns="http://s3.amazonaws.com/doc/2006-3-01"><Days>' + days.to_s + '</Days></RestoreRequest>'
23
23
 
24
24
  headers = {}
25
- headers['Content-MD5'] = Base64.encode64(Digest::MD5.digest(data)).strip
25
+ headers['Content-MD5'] = Base64.encode64(OpenSSL::Digest::MD5.digest(data)).strip
26
26
  headers['Content-Type'] = 'application/xml'
27
27
  headers['Date'] = Fog::Time.now.to_date_header
28
28
 
@@ -37,7 +37,7 @@ module Fog
37
37
  headers['x-amz-acl'] = acl
38
38
  end
39
39
 
40
- headers['Content-MD5'] = Base64.encode64(Digest::MD5.digest(data)).strip
40
+ headers['Content-MD5'] = Base64.encode64(OpenSSL::Digest::MD5.digest(data)).strip
41
41
  headers['Content-Type'] = 'application/json'
42
42
  headers['Date'] = Fog::Time.now.to_date_header
43
43
 
@@ -22,7 +22,7 @@ module Fog
22
22
  data = Fog::Storage::AWS.hash_to_cors(cors)
23
23
 
24
24
  headers = {}
25
- headers['Content-MD5'] = Base64.encode64(Digest::MD5.digest(data)).strip
25
+ headers['Content-MD5'] = Base64.encode64(OpenSSL::Digest::MD5.digest(data)).strip
26
26
  headers['Content-Type'] = 'application/json'
27
27
  headers['Date'] = Fog::Time.now.to_date_header
28
28
 
@@ -86,7 +86,7 @@ module Fog
86
86
  request({
87
87
  :body => body,
88
88
  :expects => 200,
89
- :headers => {'Content-MD5' => Base64.encode64(Digest::MD5.digest(body)).chomp!,
89
+ :headers => {'Content-MD5' => Base64.encode64(OpenSSL::Digest::MD5.digest(body)).chomp!,
90
90
  'Content-Type' => 'application/xml'},
91
91
  :bucket_name => bucket_name,
92
92
  :method => 'PUT',
@@ -54,7 +54,7 @@ module Fog
54
54
  request({
55
55
  :body => body,
56
56
  :expects => 200,
57
- :headers => {'Content-MD5' => Base64.encode64(Digest::MD5.digest(body)).chomp!,
57
+ :headers => {'Content-MD5' => Base64.encode64(OpenSSL::Digest::MD5.digest(body)).chomp!,
58
58
  'Content-Type' => 'application/xml'},
59
59
  :bucket_name => bucket_name,
60
60
  :method => 'PUT',
@@ -27,7 +27,7 @@ DATA
27
27
  request({
28
28
  :body => data,
29
29
  :expects => 204,
30
- :headers => {'Content-MD5' => Base64.encode64(Digest::MD5.digest(data)).chomp!, 'Content-Type' => 'application/xml'},
30
+ :headers => {'Content-MD5' => Base64.encode64(OpenSSL::Digest::MD5.digest(data)).chomp!, 'Content-Type' => 'application/xml'},
31
31
  :bucket_name => bucket_name,
32
32
  :method => 'PUT',
33
33
  :query => {'tagging' => nil}
@@ -45,7 +45,7 @@ module Fog
45
45
  headers['x-amz-acl'] = acl
46
46
  end
47
47
 
48
- headers['Content-MD5'] = Base64.encode64(Digest::MD5.digest(data)).strip
48
+ headers['Content-MD5'] = Base64.encode64(OpenSSL::Digest::MD5.digest(data)).strip
49
49
  headers['Content-Type'] = 'application/json'
50
50
  headers['Date'] = Fog::Time.now.to_date_header
51
51
 
@@ -50,7 +50,7 @@ module Fog
50
50
  object = {
51
51
  :body => body,
52
52
  'Content-Type' => options['Content-Type'],
53
- 'ETag' => Digest::MD5.hexdigest(body),
53
+ 'ETag' => OpenSSL::Digest::MD5.hexdigest(body),
54
54
  'Key' => object_name,
55
55
  'Last-Modified' => Fog::Time.now.to_date_header,
56
56
  'Content-Length' => options['Content-Length'],
@@ -40,7 +40,7 @@ module Fog
40
40
  #{canonical_query_string(params[:query])}
41
41
  #{canonical_headers(params[:headers])}
42
42
  #{signed_headers(params[:headers])}
43
- #{body_sha || Digest::SHA256.hexdigest(params[:body] || '')}
43
+ #{body_sha || OpenSSL::Digest::SHA256.hexdigest(params[:body] || '')}
44
44
  DATA
45
45
  canonical_request.chop!
46
46
 
@@ -48,7 +48,7 @@ DATA
48
48
  #{ALGORITHM}
49
49
  #{date.to_iso8601_basic}
50
50
  #{credential_scope(date)}
51
- #{Digest::SHA256.hexdigest(canonical_request)}
51
+ #{OpenSSL::Digest::SHA256.hexdigest(canonical_request)}
52
52
  DATA
53
53
 
54
54
  string_to_sign.chop!
@@ -585,7 +585,7 @@ module Fog
585
585
  params[:headers]['x-amz-content-sha256'] = 'STREAMING-AWS4-HMAC-SHA256-PAYLOAD'
586
586
  params[:headers]['x-amz-decoded-content-length'] = params[:headers].delete 'Content-Length'
587
587
  else
588
- params[:headers]['x-amz-content-sha256'] ||= Digest::SHA256.hexdigest(params[:body] || '')
588
+ params[:headers]['x-amz-content-sha256'] ||= OpenSSL::Digest::SHA256.hexdigest(params[:body] || '')
589
589
  end
590
590
  signature_components = @signer.signature_components(params, date, params[:headers]['x-amz-content-sha256'])
591
591
  params[:headers]['Authorization'] = @signer.components_to_header(signature_components)
@@ -692,8 +692,8 @@ AWS4-HMAC-SHA256-PAYLOAD
692
692
  #{date.to_iso8601_basic}
693
693
  #{signer.credential_scope(date)}
694
694
  #{previous_signature}
695
- #{Digest::SHA256.hexdigest('')}
696
- #{Digest::SHA256.hexdigest(data)}
695
+ #{OpenSSL::Digest::SHA256.hexdigest('')}
696
+ #{OpenSSL::Digest::SHA256.hexdigest(data)}
697
697
  DATA
698
698
  hmac = signer.derived_hmac(date)
699
699
  hmac.sign(string_to_sign.strip).unpack('H*').first
@@ -1,5 +1,5 @@
1
1
  module Fog
2
2
  module AWS
3
- VERSION = "0.9.3"
3
+ VERSION = "0.9.4"
4
4
  end
5
5
  end
@@ -99,7 +99,7 @@ Shindo.tests("Storage[:aws] | file", ["aws"]) do
99
99
  @directory.files.get('multipart-encrypted-upload',
100
100
  'x-amz-server-side-encryption-customer-algorithm' => 'AES256',
101
101
  'x-amz-server-side-encryption-customer-key' => Base64.encode64(encryption_key).chomp!,
102
- 'x-amz-server-side-encryption-customer-key-MD5' => Base64.encode64(Digest::MD5.digest(encryption_key.to_s)).chomp!
102
+ 'x-amz-server-side-encryption-customer-key-MD5' => Base64.encode64(OpenSSL::Digest::MD5.digest(encryption_key.to_s)).chomp!
103
103
  ).body == "x" * 6*1024**2
104
104
  end
105
105
 
@@ -1,27 +1,27 @@
1
1
  Shindo.tests('AWS::Glacier | glacier tree hash calcuation', ['aws']) do
2
2
 
3
3
  tests('tree_hash(single part < 1MB)') do
4
- returns(Digest::SHA256.hexdigest('')) { Fog::AWS::Glacier::TreeHash.digest('')}
4
+ returns(OpenSSL::Digest::SHA256.hexdigest('')) { Fog::AWS::Glacier::TreeHash.digest('')}
5
5
  end
6
6
 
7
7
  tests('tree_hash(multibyte characters)') do
8
8
  body = ("\xC2\xA1" * 1024*1024)
9
9
  body.force_encoding('UTF-8') if body.respond_to? :encoding
10
10
 
11
- expected = Digest::SHA256.hexdigest(
12
- Digest::SHA256.digest("\xC2\xA1" * 1024*512) + Digest::SHA256.digest("\xC2\xA1" * 1024*512)
11
+ expected = OpenSSL::Digest::SHA256.hexdigest(
12
+ OpenSSL::Digest::SHA256.digest("\xC2\xA1" * 1024*512) + OpenSSL::Digest::SHA256.digest("\xC2\xA1" * 1024*512)
13
13
  )
14
14
  returns(expected) { Fog::AWS::Glacier::TreeHash.digest(body)}
15
15
  end
16
16
 
17
17
  tests('tree_hash(power of 2 number of parts)') do
18
18
  body = ('x' * 1024*1024) + ('y'*1024*1024) + ('z'*1024*1024) + ('t'*1024*1024)
19
- expected = Digest::SHA256.hexdigest(
20
- Digest::SHA256.digest(
21
- Digest::SHA256.digest('x' * 1024*1024) + Digest::SHA256.digest('y' * 1024*1024)
19
+ expected = OpenSSL::Digest::SHA256.hexdigest(
20
+ OpenSSL::Digest::SHA256.digest(
21
+ OpenSSL::Digest::SHA256.digest('x' * 1024*1024) + OpenSSL::Digest::SHA256.digest('y' * 1024*1024)
22
22
  ) +
23
- Digest::SHA256.digest(
24
- Digest::SHA256.digest('z' * 1024*1024) + Digest::SHA256.digest('t' * 1024*1024)
23
+ OpenSSL::Digest::SHA256.digest(
24
+ OpenSSL::Digest::SHA256.digest('z' * 1024*1024) + OpenSSL::Digest::SHA256.digest('t' * 1024*1024)
25
25
  )
26
26
  )
27
27
 
@@ -30,11 +30,11 @@ Shindo.tests('AWS::Glacier | glacier tree hash calcuation', ['aws']) do
30
30
 
31
31
  tests('tree_hash(non power of 2 number of parts)') do
32
32
  body = ('x' * 1024*1024) + ('y'*1024*1024) + ('z'*1024*1024)
33
- expected = Digest::SHA256.hexdigest(
34
- Digest::SHA256.digest(
35
- Digest::SHA256.digest('x' * 1024*1024) + Digest::SHA256.digest('y' * 1024*1024)
33
+ expected = OpenSSL::Digest::SHA256.hexdigest(
34
+ OpenSSL::Digest::SHA256.digest(
35
+ OpenSSL::Digest::SHA256.digest('x' * 1024*1024) + OpenSSL::Digest::SHA256.digest('y' * 1024*1024)
36
36
  ) +
37
- Digest::SHA256.digest('z' * 1024*1024)
37
+ OpenSSL::Digest::SHA256.digest('z' * 1024*1024)
38
38
  )
39
39
 
40
40
  returns(expected) { Fog::AWS::Glacier::TreeHash.digest(body)}
@@ -47,12 +47,12 @@ Shindo.tests('AWS::Glacier | glacier tree hash calcuation', ['aws']) do
47
47
 
48
48
  tree_hash.add_part('z'* 1024*1024 + 't'*1024*1024)
49
49
 
50
- expected = Digest::SHA256.hexdigest(
51
- Digest::SHA256.digest(
52
- Digest::SHA256.digest('x' * 1024*1024) + Digest::SHA256.digest('y' * 1024*1024)
50
+ expected = OpenSSL::Digest::SHA256.hexdigest(
51
+ OpenSSL::Digest::SHA256.digest(
52
+ OpenSSL::Digest::SHA256.digest('x' * 1024*1024) + OpenSSL::Digest::SHA256.digest('y' * 1024*1024)
53
53
  ) +
54
- Digest::SHA256.digest(
55
- Digest::SHA256.digest('z' * 1024*1024) + Digest::SHA256.digest('t' * 1024*1024)
54
+ OpenSSL::Digest::SHA256.digest(
55
+ OpenSSL::Digest::SHA256.digest('z' * 1024*1024) + OpenSSL::Digest::SHA256.digest('t' * 1024*1024)
56
56
  )
57
57
  )
58
58
  returns(expected) { tree_hash.hexdigest}
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: 0.9.3
4
+ version: 0.9.4
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: 2016-06-20 00:00:00.000000000 Z
12
+ date: 2016-06-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler