fog-aws 3.8.0 → 3.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -0
- data/CHANGELOG.md +14 -5
- data/lib/fog/aws/credential_fetcher.rb +3 -1
- data/lib/fog/aws/models/storage/files.rb +32 -2
- data/lib/fog/aws/version.rb +1 -1
- data/tests/credentials_tests.rb +12 -0
- data/tests/helpers/succeeds_helper.rb +2 -2
- data/tests/models/storage/files_tests.rb +32 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8adda78ff8e95ea706342dc8aabe0c529e1fd26bdbf5ed63e0d63f1a4ab50a8c
|
4
|
+
data.tar.gz: 5afbb4be420bd1cc45e6bfd54cc3c8711f63854a9a8906677f08bfdf007b637d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c92f603e887e44f354d851a309401b87cb01e83cb4c83833c8fb33edeb15357e8a4b0b0c8ae9c6dfc96ff24f85664287b8cfa8fe5fde7fb90b344a47d9f90bae
|
7
|
+
data.tar.gz: 4e4bdee040f173c7cbd19f89938e4cb93ce849feda86bb87bee20339ffee211434195fa1512b2426d70ca4e13152c4497db422d03881a2dfef7276b91d37c5bb
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,16 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
-
## [v3.
|
3
|
+
## [v3.9.0](https://github.com/fog/fog-aws/tree/v3.9.0) (2021-03-02)
|
4
4
|
|
5
|
+
[Full Changelog](https://github.com/fog/fog-aws/compare/v3.8.0...v3.9.0)
|
6
|
+
|
7
|
+
**Merged pull requests:**
|
8
|
+
|
9
|
+
- Fix handling of lowercased HTTP headers [\#597](https://github.com/fog/fog-aws/pull/597) ([stanhu](https://github.com/stanhu))
|
10
|
+
- Generate a default session name if one is not provided [\#595](https://github.com/fog/fog-aws/pull/595) ([stanhu](https://github.com/stanhu))
|
11
|
+
- Enable test on Ruby 3.0 [\#591](https://github.com/fog/fog-aws/pull/591) ([voxik](https://github.com/voxik))
|
12
|
+
|
13
|
+
## [v3.8.0](https://github.com/fog/fog-aws/tree/v3.8.0) (2021-01-13)
|
5
14
|
[Full Changelog](https://github.com/fog/fog-aws/compare/v3.7.0...v3.8.0)
|
6
15
|
|
7
16
|
**Closed issues:**
|
@@ -10,7 +19,7 @@
|
|
10
19
|
|
11
20
|
**Merged pull requests:**
|
12
21
|
|
13
|
-
- Filter unknown UploadPartCopy
|
22
|
+
- Filter unknown UploadPartCopy parameters [\#589](https://github.com/fog/fog-aws/pull/589) ([stanhu](https://github.com/stanhu))
|
14
23
|
- Fix NameError in multipart copy [\#588](https://github.com/fog/fog-aws/pull/588) ([stanhu](https://github.com/stanhu))
|
15
24
|
- Rewind pointer if file is eof on put\_object mock [\#587](https://github.com/fog/fog-aws/pull/587) ([ekulz](https://github.com/ekulz))
|
16
25
|
- Update .travis.yml [\#584](https://github.com/fog/fog-aws/pull/584) ([nageshlop](https://github.com/nageshlop))
|
@@ -49,6 +58,7 @@
|
|
49
58
|
**Merged pull requests:**
|
50
59
|
|
51
60
|
- added missing region EU South \(Milan\) [\#570](https://github.com/fog/fog-aws/pull/570) ([saldan](https://github.com/saldan))
|
61
|
+
- hibernation option to compute [\#569](https://github.com/fog/fog-aws/pull/569) ([taniahagan](https://github.com/taniahagan))
|
52
62
|
- Fix VPC model is\_default requires [\#567](https://github.com/fog/fog-aws/pull/567) ([biinari](https://github.com/biinari))
|
53
63
|
|
54
64
|
## [v3.6.5](https://github.com/fog/fog-aws/tree/v3.6.5) (2020-05-22)
|
@@ -97,7 +107,6 @@
|
|
97
107
|
|
98
108
|
**Merged pull requests:**
|
99
109
|
|
100
|
-
- hibernation option to compute [\#569](https://github.com/fog/fog-aws/pull/569) ([taniahagan](https://github.com/taniahagan))
|
101
110
|
- Adding two missing regions to Fog::AWS.regions [\#552](https://github.com/fog/fog-aws/pull/552) ([lvangool](https://github.com/lvangool))
|
102
111
|
- Adds missing param WebIdentityToken for the request to the AWS api [\#550](https://github.com/fog/fog-aws/pull/550) ([dgoradia](https://github.com/dgoradia))
|
103
112
|
- Fixes type in class name for STS assume\_role\_with\_web\_identity parser [\#549](https://github.com/fog/fog-aws/pull/549) ([dgoradia](https://github.com/dgoradia))
|
@@ -378,7 +387,6 @@
|
|
378
387
|
- Fog mock accuracy, fixes \#341 [\#344](https://github.com/fog/fog-aws/pull/344) ([easkay](https://github.com/easkay))
|
379
388
|
- Subnet [\#343](https://github.com/fog/fog-aws/pull/343) ([ehowe](https://github.com/ehowe))
|
380
389
|
- Fix multipart upload [\#340](https://github.com/fog/fog-aws/pull/340) ([nobmurakita](https://github.com/nobmurakita))
|
381
|
-
- credential\_fetcher: Mark AWS metadata calls as idempotent [\#329](https://github.com/fog/fog-aws/pull/329) ([mtekel](https://github.com/mtekel))
|
382
390
|
|
383
391
|
## [v1.2.0](https://github.com/fog/fog-aws/tree/v1.2.0) (2017-01-20)
|
384
392
|
[Full Changelog](https://github.com/fog/fog-aws/compare/v1.1.0...v1.2.0)
|
@@ -406,13 +414,14 @@
|
|
406
414
|
- Canada and London regions [\#333](https://github.com/fog/fog-aws/pull/333) ([mattheworiordan](https://github.com/mattheworiordan))
|
407
415
|
- Updated ELB Dual Stack hosted zone DNS records [\#332](https://github.com/fog/fog-aws/pull/332) ([mattheworiordan](https://github.com/mattheworiordan))
|
408
416
|
- Added support for attaching auto scaling groups to target groups [\#330](https://github.com/fog/fog-aws/pull/330) ([maf23](https://github.com/maf23))
|
409
|
-
-
|
417
|
+
- credential\_fetcher: Mark AWS metadata calls as idempotent [\#329](https://github.com/fog/fog-aws/pull/329) ([mtekel](https://github.com/mtekel))
|
410
418
|
|
411
419
|
## [v1.0.0](https://github.com/fog/fog-aws/tree/v1.0.0) (2016-12-12)
|
412
420
|
[Full Changelog](https://github.com/fog/fog-aws/compare/v0.13.0...v1.0.0)
|
413
421
|
|
414
422
|
**Merged pull requests:**
|
415
423
|
|
424
|
+
- fix host header with another port on s3 [\#327](https://github.com/fog/fog-aws/pull/327) ([rodrigoapereira](https://github.com/rodrigoapereira))
|
416
425
|
- Add new t2.xlarge, t2.2xlarge and r4 class instances. [\#326](https://github.com/fog/fog-aws/pull/326) ([rogersd](https://github.com/rogersd))
|
417
426
|
- Fix the bug that can't create fifo queue in SQS. [\#323](https://github.com/fog/fog-aws/pull/323) ([ebihara99999](https://github.com/ebihara99999))
|
418
427
|
- data pipeline mocks [\#318](https://github.com/fog/fog-aws/pull/318) ([ehowe](https://github.com/ehowe))
|
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'securerandom'
|
4
|
+
|
3
5
|
module Fog
|
4
6
|
module AWS
|
5
7
|
module CredentialFetcher
|
@@ -38,7 +40,7 @@ module Fog
|
|
38
40
|
params = {
|
39
41
|
:Action => "AssumeRoleWithWebIdentity",
|
40
42
|
:RoleArn => options[:role_arn] || ENV.fetch("AWS_ROLE_ARN"),
|
41
|
-
:RoleSessionName => options[:role_session_name] || ENV
|
43
|
+
:RoleSessionName => options[:role_session_name] || ENV["AWS_ROLE_SESSION_NAME"] || "fog-aws-#{SecureRandom.hex}",
|
42
44
|
:WebIdentityToken => File.read(options[:aws_web_identity_token_file] || ENV.fetch("AWS_WEB_IDENTITY_TOKEN_FILE")),
|
43
45
|
:Version => "2011-06-15",
|
44
46
|
}
|
@@ -17,6 +17,15 @@ module Fog
|
|
17
17
|
|
18
18
|
model Fog::AWS::Storage::File
|
19
19
|
|
20
|
+
DASHED_HEADERS = %w(
|
21
|
+
Cache-Control
|
22
|
+
Content-Disposition
|
23
|
+
Content-Encoding
|
24
|
+
Content-Length
|
25
|
+
Content-MD5
|
26
|
+
Content-Type
|
27
|
+
).freeze
|
28
|
+
|
20
29
|
def all(options = {})
|
21
30
|
requires :directory
|
22
31
|
options = {
|
@@ -114,8 +123,29 @@ module Fog
|
|
114
123
|
end
|
115
124
|
|
116
125
|
def normalize_headers(data)
|
117
|
-
data.headers['Last-Modified'] = Time.parse(data
|
118
|
-
|
126
|
+
data.headers['Last-Modified'] = Time.parse(fetch_and_delete_header(data, 'Last-Modified'))
|
127
|
+
|
128
|
+
etag = fetch_and_delete_header(data, 'ETag').gsub('"','')
|
129
|
+
data.headers['ETag'] = etag
|
130
|
+
|
131
|
+
DASHED_HEADERS.each do |header|
|
132
|
+
value = fetch_and_delete_header(data, header)
|
133
|
+
data.headers[header] = value if value
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
private
|
138
|
+
|
139
|
+
def fetch_and_delete_header(response, header)
|
140
|
+
value = response.get_header(header)
|
141
|
+
|
142
|
+
return unless value
|
143
|
+
|
144
|
+
response.headers.keys.each do |key|
|
145
|
+
response.headers.delete(key) if key.downcase == header.downcase
|
146
|
+
end
|
147
|
+
|
148
|
+
value
|
119
149
|
end
|
120
150
|
end
|
121
151
|
end
|
data/lib/fog/aws/version.rb
CHANGED
data/tests/credentials_tests.rb
CHANGED
@@ -87,6 +87,18 @@ Shindo.tests('AWS | credentials', ['aws']) do
|
|
87
87
|
) { Fog::AWS::Compute.fetch_credentials(use_iam_profile: true) }
|
88
88
|
end
|
89
89
|
|
90
|
+
ENV['AWS_ROLE_SESSION_NAME'] = nil
|
91
|
+
|
92
|
+
tests('#fetch_credentials token based without session name') do
|
93
|
+
returns(
|
94
|
+
aws_access_key_id: 'dummykey',
|
95
|
+
aws_secret_access_key: 'dummysecret',
|
96
|
+
aws_session_token: 'dummytoken',
|
97
|
+
region: 'us-west-1',
|
98
|
+
aws_credentials_expire_at: expires_at
|
99
|
+
) { Fog::AWS::Compute.fetch_credentials(use_iam_profile: true) }
|
100
|
+
end
|
101
|
+
|
90
102
|
ENV['AWS_WEB_IDENTITY_TOKEN_FILE'] = nil
|
91
103
|
|
92
104
|
compute = Fog::AWS::Compute.new(use_iam_profile: true)
|
@@ -50,6 +50,38 @@ Shindo.tests("Storage[:aws] | files", ["aws"]) do
|
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
|
+
tests('#normalize_headers') do
|
54
|
+
files = @directory.files
|
55
|
+
response = Excon::Response.new
|
56
|
+
current_time = Time.new(2021, 02, 21)
|
57
|
+
|
58
|
+
response.headers['last-modified'] = current_time.to_s
|
59
|
+
response.headers['etag'] = '12345'
|
60
|
+
response.headers['ETAG'] = '12345'
|
61
|
+
response.headers['Cache-Control'] = 'no-cache'
|
62
|
+
response.headers['Content-disposition'] = 'attachment'
|
63
|
+
response.headers['content-length'] = 100
|
64
|
+
response.headers['content-Encoding'] = 'gzip'
|
65
|
+
response.headers['content-md5'] = 'ABCDEAB'
|
66
|
+
response.headers['content-Md5'] = 'ABCDEAB'
|
67
|
+
response.headers['ConTent-Type'] = 'application/json'
|
68
|
+
|
69
|
+
expected = {
|
70
|
+
'Last-Modified' => current_time,
|
71
|
+
'ETag' => '12345',
|
72
|
+
'Cache-Control' => 'no-cache',
|
73
|
+
'Content-Disposition' => 'attachment',
|
74
|
+
'Content-Length' => 100,
|
75
|
+
'Content-Encoding' => 'gzip',
|
76
|
+
'Content-MD5' => 'ABCDEAB',
|
77
|
+
'Content-Type' => 'application/json'
|
78
|
+
}
|
79
|
+
|
80
|
+
tests('header keys are normalized').returns(expected) do
|
81
|
+
files.normalize_headers(response)
|
82
|
+
response.headers
|
83
|
+
end
|
84
|
+
end
|
53
85
|
end
|
54
86
|
|
55
87
|
@directory.versions.each(&:destroy)
|
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: 3.
|
4
|
+
version: 3.9.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: 2021-
|
12
|
+
date: 2021-03-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|