gitlab-fog-azure-rm 2.3.0 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitlab-ci.yml +7 -4
- data/.rubocop_todo.yml +188 -82
- data/CHANGELOG.md +8 -0
- data/gitlab-fog-azure-rm.gemspec +6 -4
- data/lib/azure/core/auth/shared_key.rb +3 -1
- data/lib/fog/azurerm/identity/credentials.rb +1 -1
- data/lib/fog/azurerm/identity/default_credentials.rb +2 -6
- data/lib/fog/azurerm/requests/storage/get_blob_url.rb +2 -2
- data/lib/fog/azurerm/requests/storage/get_container_url.rb +2 -2
- data/lib/fog/azurerm/storage.rb +41 -21
- data/lib/fog/azurerm/utilities/general.rb +1 -1
- data/lib/fog/azurerm/version.rb +1 -1
- data/test/requests/storage/test_get_blob.rb +4 -4
- data/test/requests/storage/test_get_blob_https_url.rb +70 -0
- data/test/test_helper.rb +1 -0
- data/test/unit/test_credentials.rb +44 -0
- data/test/unit/test_default_credentials.rb +28 -44
- metadata +42 -10
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f3c8efd2c5ce76c59fe96a72faceb7470f8a1bc0e75ffdef6808434583108cdf
|
|
4
|
+
data.tar.gz: 72fce32424077553bb8c4b6e8a1a6ffa56307261352a801355b1a93878628715
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6cf9691fa2a0423b6da2f5b0874447364207d0a1e10852a11f3e14cd5fc213fc20a8de8987263e70d0f04ac59d5c044779ced3c8bb8451d13622c608f1e73f29
|
|
7
|
+
data.tar.gz: e92ddc401cdf2b5e606afd6342ef6a136e7d6dae56590fa27338cdfb42dd6a6b2f563f1cde3290274182e3d1370355cc94aefeb1b67261bb555ff031df631b8d
|
data/.gitlab-ci.yml
CHANGED
|
@@ -4,26 +4,29 @@ include:
|
|
|
4
4
|
default:
|
|
5
5
|
image: "ruby:${RUBY_VERSION}"
|
|
6
6
|
|
|
7
|
+
variables:
|
|
8
|
+
BUNDLE_PATH: vendor
|
|
9
|
+
|
|
7
10
|
cache:
|
|
8
11
|
paths:
|
|
9
12
|
- vendor/ruby
|
|
10
13
|
|
|
11
14
|
before_script:
|
|
12
15
|
- ruby -v
|
|
13
|
-
- bundle install -j $(nproc)
|
|
16
|
+
- bundle install -j $(nproc)
|
|
14
17
|
|
|
15
18
|
test:
|
|
16
19
|
script:
|
|
17
20
|
- bundle exec rake test
|
|
18
21
|
parallel:
|
|
19
22
|
matrix:
|
|
20
|
-
- RUBY_VERSION: [ "2
|
|
23
|
+
- RUBY_VERSION: [ "3.2", "3.3", "3.4", "4.0" ]
|
|
21
24
|
|
|
22
25
|
rubocop:
|
|
23
26
|
script:
|
|
24
27
|
- bundle exec rubocop
|
|
25
28
|
variables:
|
|
26
|
-
RUBY_VERSION: "
|
|
29
|
+
RUBY_VERSION: "4.0"
|
|
27
30
|
|
|
28
31
|
integration:
|
|
29
32
|
services:
|
|
@@ -32,4 +35,4 @@ integration:
|
|
|
32
35
|
script:
|
|
33
36
|
- bundle exec rake integration
|
|
34
37
|
variables:
|
|
35
|
-
RUBY_VERSION: "
|
|
38
|
+
RUBY_VERSION: "4.0"
|
data/.rubocop_todo.yml
CHANGED
|
@@ -1,41 +1,71 @@
|
|
|
1
1
|
# This configuration was generated by
|
|
2
2
|
# `rubocop --auto-gen-config`
|
|
3
|
-
# on
|
|
3
|
+
# on 2026-03-31 03:13:36 UTC using RuboCop version 1.86.0.
|
|
4
4
|
# The point is for the user to remove these configuration records
|
|
5
5
|
# one by one as the offenses are removed from the code base.
|
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
|
8
8
|
|
|
9
9
|
# Offense count: 1
|
|
10
|
-
#
|
|
11
|
-
|
|
10
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
11
|
+
Gemspec/DeprecatedAttributeAssignment:
|
|
12
|
+
Exclude:
|
|
13
|
+
- 'gitlab-fog-azure-rm.gemspec'
|
|
14
|
+
|
|
15
|
+
# Offense count: 8
|
|
16
|
+
# Configuration parameters: EnforcedStyle, AllowedGems.
|
|
17
|
+
# SupportedStyles: Gemfile, gems.rb, gemspec
|
|
18
|
+
Gemspec/DevelopmentDependencies:
|
|
19
|
+
Exclude:
|
|
20
|
+
- 'gitlab-fog-azure-rm.gemspec'
|
|
21
|
+
|
|
22
|
+
# Offense count: 1
|
|
23
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
24
|
+
Gemspec/RequireMFA:
|
|
25
|
+
Exclude:
|
|
26
|
+
- 'gitlab-fog-azure-rm.gemspec'
|
|
27
|
+
|
|
28
|
+
# Offense count: 1
|
|
12
29
|
Gemspec/RequiredRubyVersion:
|
|
13
30
|
Exclude:
|
|
14
31
|
- 'gitlab-fog-azure-rm.gemspec'
|
|
15
32
|
|
|
16
|
-
# Offense count:
|
|
17
|
-
#
|
|
33
|
+
# Offense count: 21
|
|
34
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
18
35
|
Layout/EmptyLineAfterGuardClause:
|
|
19
|
-
|
|
36
|
+
Exclude:
|
|
37
|
+
- 'lib/fog/azurerm/models/storage/directories.rb'
|
|
38
|
+
- 'lib/fog/azurerm/models/storage/files.rb'
|
|
39
|
+
- 'lib/fog/azurerm/requests/storage/delete_blob.rb'
|
|
40
|
+
- 'lib/fog/azurerm/requests/storage/delete_container.rb'
|
|
41
|
+
- 'lib/fog/azurerm/requests/storage/get_blob.rb'
|
|
42
|
+
- 'lib/fog/azurerm/requests/storage/get_blob_properties.rb'
|
|
43
|
+
- 'lib/fog/azurerm/requests/storage/get_container_properties.rb'
|
|
44
|
+
- 'lib/fog/azurerm/requests/storage/list_blobs.rb'
|
|
45
|
+
- 'lib/fog/azurerm/requests/storage/list_containers.rb'
|
|
46
|
+
- 'lib/fog/azurerm/requests/storage/save_page_blob.rb'
|
|
47
|
+
- 'lib/fog/azurerm/utilities/general.rb'
|
|
48
|
+
- 'test/integration/blob.rb'
|
|
49
|
+
- 'test/requests/storage/test_list_blobs.rb'
|
|
50
|
+
- 'test/requests/storage/test_list_containers.rb'
|
|
51
|
+
- 'test/requests/storage/test_save_page_blob.rb'
|
|
52
|
+
|
|
53
|
+
# Offense count: 1
|
|
54
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
55
|
+
Layout/EmptyLinesAfterModuleInclusion:
|
|
56
|
+
Exclude:
|
|
57
|
+
- 'lib/fog/azurerm/identity/base_client.rb'
|
|
20
58
|
|
|
21
59
|
# Offense count: 1
|
|
22
|
-
#
|
|
60
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
23
61
|
# Configuration parameters: AllowAliasSyntax, AllowedMethods.
|
|
24
62
|
# AllowedMethods: alias_method, public, protected, private
|
|
25
63
|
Layout/EmptyLinesAroundAttributeAccessor:
|
|
26
64
|
Exclude:
|
|
27
65
|
- 'lib/fog/azurerm/models/storage/file.rb'
|
|
28
66
|
|
|
29
|
-
# Offense count:
|
|
30
|
-
#
|
|
31
|
-
# SupportedStyles: native, lf, crlf
|
|
32
|
-
Layout/EndOfLine:
|
|
33
|
-
Exclude:
|
|
34
|
-
- 'lib/fog/azurerm/models/resources/azure_resource.rb'
|
|
35
|
-
- 'lib/fog/azurerm/models/resources/azure_resources.rb'
|
|
36
|
-
|
|
37
|
-
# Offense count: 13
|
|
38
|
-
# Cop supports --auto-correct.
|
|
67
|
+
# Offense count: 6
|
|
68
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
39
69
|
# Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
|
|
40
70
|
# SupportedHashRocketStyles: key, separator, table
|
|
41
71
|
# SupportedColonStyles: key, separator, table
|
|
@@ -43,10 +73,9 @@ Layout/EndOfLine:
|
|
|
43
73
|
Layout/HashAlignment:
|
|
44
74
|
Exclude:
|
|
45
75
|
- 'lib/fog/azurerm/models/storage/file.rb'
|
|
46
|
-
- 'test/test_helper.rb'
|
|
47
76
|
|
|
48
77
|
# Offense count: 1
|
|
49
|
-
#
|
|
78
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
50
79
|
# Configuration parameters: EnforcedStyle.
|
|
51
80
|
# SupportedStyles: space, no_space
|
|
52
81
|
Layout/SpaceAroundEqualsInParameterDefault:
|
|
@@ -54,62 +83,77 @@ Layout/SpaceAroundEqualsInParameterDefault:
|
|
|
54
83
|
- 'lib/fog/azurerm/requests/storage/release_container_lease.rb'
|
|
55
84
|
|
|
56
85
|
# Offense count: 1
|
|
57
|
-
#
|
|
86
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
58
87
|
Layout/SpaceBeforeComma:
|
|
59
88
|
Exclude:
|
|
60
89
|
- 'gitlab-fog-azure-rm.gemspec'
|
|
61
90
|
|
|
91
|
+
# Offense count: 18
|
|
92
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
93
|
+
Lint/AmbiguousOperatorPrecedence:
|
|
94
|
+
Exclude:
|
|
95
|
+
- 'test/integration/blob.rb'
|
|
96
|
+
- 'test/models/storage/test_file.rb'
|
|
97
|
+
- 'test/requests/storage/test_get_blob_https_url.rb'
|
|
98
|
+
|
|
62
99
|
# Offense count: 2
|
|
63
100
|
Lint/DuplicateMethods:
|
|
64
101
|
Exclude:
|
|
65
102
|
- 'lib/fog/azurerm/models/storage/directory.rb'
|
|
66
103
|
- 'lib/fog/azurerm/models/storage/file.rb'
|
|
67
104
|
|
|
105
|
+
# Offense count: 3
|
|
106
|
+
# Configuration parameters: AllowComments, AllowEmptyLambdas.
|
|
107
|
+
Lint/EmptyBlock:
|
|
108
|
+
Exclude:
|
|
109
|
+
- 'test/requests/storage/test_get_blob.rb'
|
|
110
|
+
|
|
111
|
+
# Offense count: 8
|
|
112
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
113
|
+
Lint/NonAtomicFileOperation:
|
|
114
|
+
Exclude:
|
|
115
|
+
- 'test/integration/blob.rb'
|
|
116
|
+
|
|
68
117
|
# Offense count: 2
|
|
69
118
|
Lint/RescueException:
|
|
70
119
|
Exclude:
|
|
71
120
|
- 'lib/fog/azurerm/models/storage/directories.rb'
|
|
72
121
|
- 'lib/fog/azurerm/requests/storage/check_container_exists.rb'
|
|
73
122
|
|
|
74
|
-
# Offense count: 3
|
|
75
|
-
Lint/UselessAssignment:
|
|
76
|
-
Exclude:
|
|
77
|
-
- 'lib/fog/azurerm/storage.rb'
|
|
78
|
-
- 'test/integration/container.rb'
|
|
79
|
-
|
|
80
123
|
# Offense count: 1
|
|
124
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
81
125
|
# Configuration parameters: CheckForMethodsWithNoSideEffects.
|
|
82
126
|
Lint/Void:
|
|
83
127
|
Exclude:
|
|
84
128
|
- 'lib/fog/azurerm/models/storage/directory.rb'
|
|
85
129
|
|
|
86
|
-
# Offense count:
|
|
87
|
-
# Configuration parameters:
|
|
130
|
+
# Offense count: 38
|
|
131
|
+
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
|
|
88
132
|
Metrics/AbcSize:
|
|
89
133
|
Max: 66
|
|
90
134
|
|
|
91
|
-
# Offense count:
|
|
135
|
+
# Offense count: 14
|
|
92
136
|
# Configuration parameters: CountComments, CountAsOne.
|
|
93
137
|
Metrics/ClassLength:
|
|
94
|
-
Max:
|
|
138
|
+
Max: 232
|
|
95
139
|
|
|
96
|
-
# Offense count:
|
|
97
|
-
# Configuration parameters:
|
|
140
|
+
# Offense count: 6
|
|
141
|
+
# Configuration parameters: AllowedMethods, AllowedPatterns.
|
|
98
142
|
Metrics/CyclomaticComplexity:
|
|
99
143
|
Max: 14
|
|
100
144
|
|
|
101
145
|
# Offense count: 98
|
|
102
|
-
# Configuration parameters: CountComments, CountAsOne,
|
|
146
|
+
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
|
|
103
147
|
Metrics/MethodLength:
|
|
104
|
-
Max:
|
|
148
|
+
Max: 110
|
|
105
149
|
|
|
106
150
|
# Offense count: 1
|
|
107
|
-
# Configuration parameters: CountKeywordArgs.
|
|
151
|
+
# Configuration parameters: CountKeywordArgs, MaxOptionalParameters.
|
|
108
152
|
Metrics/ParameterLists:
|
|
109
153
|
Max: 6
|
|
110
154
|
|
|
111
|
-
# Offense count:
|
|
112
|
-
# Configuration parameters:
|
|
155
|
+
# Offense count: 6
|
|
156
|
+
# Configuration parameters: AllowedMethods, AllowedPatterns.
|
|
113
157
|
Metrics/PerceivedComplexity:
|
|
114
158
|
Max: 14
|
|
115
159
|
|
|
@@ -120,14 +164,21 @@ Naming/ConstantName:
|
|
|
120
164
|
- 'lib/fog/azurerm/models/storage/sku_name.rb'
|
|
121
165
|
- 'lib/fog/azurerm/models/storage/sku_tier.rb'
|
|
122
166
|
|
|
123
|
-
# Offense count:
|
|
124
|
-
#
|
|
167
|
+
# Offense count: 33
|
|
168
|
+
# Configuration parameters: Mode, AllowedMethods, AllowedPatterns, AllowBangMethods, WaywardPredicates.
|
|
169
|
+
# AllowedMethods: call
|
|
170
|
+
# WaywardPredicates: infinite?, nonzero?
|
|
171
|
+
Naming/PredicateMethod:
|
|
172
|
+
Enabled: false
|
|
173
|
+
|
|
174
|
+
# Offense count: 33
|
|
175
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
125
176
|
# Configuration parameters: PreferredName.
|
|
126
177
|
Naming/RescuedExceptionsVariableName:
|
|
127
178
|
Enabled: false
|
|
128
179
|
|
|
129
|
-
# Offense count:
|
|
130
|
-
#
|
|
180
|
+
# Offense count: 10
|
|
181
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
131
182
|
# Configuration parameters: EnforcedStyle.
|
|
132
183
|
# SupportedStyles: separated, grouped
|
|
133
184
|
Style/AccessorGrouping:
|
|
@@ -135,41 +186,84 @@ Style/AccessorGrouping:
|
|
|
135
186
|
- 'lib/fog/azurerm/requests/storage/save_page_blob.rb'
|
|
136
187
|
- 'test/test_helper.rb'
|
|
137
188
|
|
|
189
|
+
# Offense count: 1
|
|
190
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
191
|
+
# Configuration parameters: EnforcedStyle, AllowedParentClasses.
|
|
192
|
+
# SupportedStyles: class_keyword, class_new, class_definition
|
|
193
|
+
Style/EmptyClassDefinition:
|
|
194
|
+
Exclude:
|
|
195
|
+
- 'lib/fog/azurerm/identity/base_client.rb'
|
|
196
|
+
|
|
138
197
|
# Offense count: 2
|
|
139
|
-
#
|
|
198
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
140
199
|
Style/ExpandPathArguments:
|
|
141
200
|
Exclude:
|
|
142
201
|
- 'gitlab-fog-azure-rm.gemspec'
|
|
143
202
|
- 'lib/fog/azurerm/utilities/general.rb'
|
|
144
203
|
|
|
145
204
|
# Offense count: 2
|
|
146
|
-
#
|
|
205
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
147
206
|
Style/ExplicitBlockArgument:
|
|
148
207
|
Exclude:
|
|
149
208
|
- 'lib/fog/azurerm/models/storage/files.rb'
|
|
150
209
|
|
|
151
|
-
# Offense count:
|
|
152
|
-
#
|
|
210
|
+
# Offense count: 4
|
|
211
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
212
|
+
# Configuration parameters: AllowedVars, DefaultToNil.
|
|
213
|
+
Style/FetchEnvVar:
|
|
214
|
+
Exclude:
|
|
215
|
+
- 'lib/fog/azurerm/identity/managed_identity_client.rb'
|
|
216
|
+
- 'lib/fog/azurerm/identity/workflow_identity_client.rb'
|
|
217
|
+
|
|
218
|
+
# Offense count: 3
|
|
219
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
220
|
+
Style/FileNull:
|
|
221
|
+
Exclude:
|
|
222
|
+
- 'test/requests/storage/test_create_block_blob.rb'
|
|
223
|
+
- 'test/requests/storage/test_save_page_blob.rb'
|
|
224
|
+
|
|
225
|
+
# Offense count: 1
|
|
226
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
227
|
+
Style/FileWrite:
|
|
228
|
+
Exclude:
|
|
229
|
+
- 'test/integration/blob.rb'
|
|
230
|
+
|
|
231
|
+
# Offense count: 119
|
|
232
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
153
233
|
# Configuration parameters: EnforcedStyle.
|
|
154
234
|
# SupportedStyles: always, always_true, never
|
|
155
235
|
Style/FrozenStringLiteralComment:
|
|
156
236
|
Enabled: false
|
|
157
237
|
|
|
158
|
-
# Offense count:
|
|
159
|
-
#
|
|
238
|
+
# Offense count: 2
|
|
239
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
160
240
|
Style/IfUnlessModifier:
|
|
161
241
|
Exclude:
|
|
162
242
|
- 'lib/fog/azurerm/requests/storage/compare_container_blobs.rb'
|
|
163
243
|
- 'lib/fog/azurerm/requests/storage/wait_blob_copy_operation_to_finish.rb'
|
|
164
244
|
|
|
245
|
+
# Offense count: 2
|
|
246
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
247
|
+
Style/MapIntoArray:
|
|
248
|
+
Exclude:
|
|
249
|
+
- 'lib/fog/azurerm/models/storage/directories.rb'
|
|
250
|
+
- 'lib/fog/azurerm/models/storage/storage_accounts.rb'
|
|
251
|
+
|
|
165
252
|
# Offense count: 1
|
|
166
|
-
#
|
|
167
|
-
|
|
253
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
254
|
+
# Configuration parameters: AllowMethodComparison, ComparisonsThreshold.
|
|
255
|
+
Style/MultipleComparison:
|
|
168
256
|
Exclude:
|
|
169
|
-
- 'lib/fog/azurerm/models/
|
|
257
|
+
- 'lib/fog/azurerm/models/storage/file.rb'
|
|
258
|
+
|
|
259
|
+
# Offense count: 1
|
|
260
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
261
|
+
Style/NegatedIfElseCondition:
|
|
262
|
+
Exclude:
|
|
263
|
+
- 'lib/fog/azurerm/models/storage/storage_accounts.rb'
|
|
170
264
|
|
|
171
265
|
# Offense count: 1
|
|
172
|
-
#
|
|
266
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
173
267
|
# Configuration parameters: AllowedMethods.
|
|
174
268
|
# AllowedMethods: be, be_a, be_an, be_between, be_falsey, be_kind_of, be_instance_of, be_truthy, be_within, eq, eql, end_with, include, match, raise_error, respond_to, start_with
|
|
175
269
|
Style/NestedParenthesizedCalls:
|
|
@@ -177,8 +271,8 @@ Style/NestedParenthesizedCalls:
|
|
|
177
271
|
- 'test/test_helper.rb'
|
|
178
272
|
|
|
179
273
|
# Offense count: 1
|
|
180
|
-
#
|
|
181
|
-
# Configuration parameters:
|
|
274
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
275
|
+
# Configuration parameters: EnforcedStyle, AllowedMethods, AllowedPatterns.
|
|
182
276
|
# SupportedStyles: predicate, comparison
|
|
183
277
|
Style/NumericPredicate:
|
|
184
278
|
Exclude:
|
|
@@ -186,13 +280,21 @@ Style/NumericPredicate:
|
|
|
186
280
|
- 'lib/fog/azurerm/requests/storage/get_blob.rb'
|
|
187
281
|
|
|
188
282
|
# Offense count: 2
|
|
283
|
+
# Configuration parameters: AllowedClasses.
|
|
284
|
+
Style/OneClassPerFile:
|
|
285
|
+
Exclude:
|
|
286
|
+
- 'test/test_helper.rb'
|
|
287
|
+
|
|
288
|
+
# Offense count: 3
|
|
289
|
+
# Configuration parameters: AllowedMethods.
|
|
290
|
+
# AllowedMethods: respond_to_missing?
|
|
189
291
|
Style/OptionalBooleanParameter:
|
|
190
292
|
Exclude:
|
|
191
293
|
- 'lib/fog/azurerm/async_response.rb'
|
|
192
294
|
- 'lib/fog/azurerm/utilities/general.rb'
|
|
193
295
|
|
|
194
|
-
# Offense count:
|
|
195
|
-
#
|
|
296
|
+
# Offense count: 33
|
|
297
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
196
298
|
# Configuration parameters: PreferredDelimiters.
|
|
197
299
|
Style/PercentLiteralDelimiters:
|
|
198
300
|
Exclude:
|
|
@@ -202,70 +304,74 @@ Style/PercentLiteralDelimiters:
|
|
|
202
304
|
- 'lib/fog/azurerm/requests/storage/copy_blob.rb'
|
|
203
305
|
- 'lib/fog/azurerm/requests/storage/copy_blob_from_uri.rb'
|
|
204
306
|
- 'test/api_stub/requests/storage/file.rb'
|
|
205
|
-
- 'test/test_helper.rb'
|
|
206
307
|
|
|
207
|
-
# Offense count:
|
|
208
|
-
#
|
|
209
|
-
# Configuration parameters: EnforcedStyle.
|
|
308
|
+
# Offense count: 46
|
|
309
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
310
|
+
# Configuration parameters: EnforcedStyle, AllowedCompactTypes.
|
|
210
311
|
# SupportedStyles: compact, exploded
|
|
211
312
|
Style/RaiseArgs:
|
|
212
313
|
Enabled: false
|
|
213
314
|
|
|
214
315
|
# Offense count: 1
|
|
215
|
-
#
|
|
316
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
216
317
|
Style/RedundantBegin:
|
|
217
318
|
Exclude:
|
|
218
319
|
- 'lib/fog/azurerm/storage.rb'
|
|
219
320
|
|
|
220
|
-
# Offense count:
|
|
221
|
-
#
|
|
321
|
+
# Offense count: 5
|
|
322
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
323
|
+
# Configuration parameters: AllowMultipleReturnValues.
|
|
324
|
+
Style/RedundantReturn:
|
|
325
|
+
Exclude:
|
|
326
|
+
- 'test/models/storage/test_files.rb'
|
|
327
|
+
- 'test/requests/storage/test_list_blobs.rb'
|
|
328
|
+
- 'test/requests/storage/test_list_containers.rb'
|
|
329
|
+
- 'test/requests/storage/test_save_page_blob.rb'
|
|
330
|
+
|
|
331
|
+
# Offense count: 9
|
|
332
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
222
333
|
# Configuration parameters: EnforcedStyle.
|
|
223
334
|
# SupportedStyles: implicit, explicit
|
|
224
335
|
Style/RescueStandardError:
|
|
225
336
|
Exclude:
|
|
226
337
|
- 'lib/fog/azurerm/models/storage/files.rb'
|
|
227
|
-
- 'lib/fog/azurerm/requests/storage/create_block_blob.rb'
|
|
228
|
-
- 'lib/fog/azurerm/requests/storage/multipart_save_block_blob.rb'
|
|
229
338
|
- 'lib/fog/azurerm/requests/storage/save_page_blob.rb'
|
|
230
339
|
- 'lib/fog/azurerm/requests/storage/wait_blob_copy_operation_to_finish.rb'
|
|
231
340
|
- 'test/integration/blob.rb'
|
|
232
341
|
- 'test/integration/container.rb'
|
|
233
|
-
- 'test/integration/storage_account.rb'
|
|
234
342
|
|
|
235
|
-
# Offense count:
|
|
236
|
-
#
|
|
237
|
-
# Configuration parameters:
|
|
238
|
-
|
|
239
|
-
Style/SafeNavigation:
|
|
343
|
+
# Offense count: 1
|
|
344
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
345
|
+
# Configuration parameters: AllowModifier.
|
|
346
|
+
Style/SoleNestedConditional:
|
|
240
347
|
Exclude:
|
|
241
|
-
- '
|
|
242
|
-
- 'test/integration/container.rb'
|
|
243
|
-
- 'test/integration/storage_account.rb'
|
|
348
|
+
- 'lib/fog/azurerm/async_response.rb'
|
|
244
349
|
|
|
245
350
|
# Offense count: 2
|
|
246
|
-
#
|
|
351
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
352
|
+
# Configuration parameters: Mode.
|
|
247
353
|
Style/StringConcatenation:
|
|
248
354
|
Exclude:
|
|
249
355
|
- 'test/integration/blob.rb'
|
|
250
356
|
|
|
251
|
-
# Offense count:
|
|
252
|
-
#
|
|
357
|
+
# Offense count: 10
|
|
358
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
253
359
|
# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
|
|
254
360
|
# SupportedStyles: single_quotes, double_quotes
|
|
255
361
|
Style/StringLiterals:
|
|
256
362
|
Exclude:
|
|
257
363
|
- 'gitlab-fog-azure-rm.gemspec'
|
|
258
364
|
|
|
259
|
-
# Offense count:
|
|
260
|
-
#
|
|
365
|
+
# Offense count: 8
|
|
366
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
261
367
|
# Configuration parameters: MinSize.
|
|
262
368
|
# SupportedStyles: percent, brackets
|
|
263
369
|
Style/SymbolArray:
|
|
264
370
|
EnforcedStyle: brackets
|
|
265
371
|
|
|
266
|
-
# Offense count:
|
|
267
|
-
#
|
|
268
|
-
# Configuration parameters:
|
|
372
|
+
# Offense count: 194
|
|
373
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
374
|
+
# Configuration parameters: AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, AllowRBSInlineAnnotation, AllowCopDirectives, AllowedPatterns, SplitStrings.
|
|
269
375
|
# URISchemes: http, https
|
|
270
376
|
Layout/LineLength:
|
|
271
|
-
Max:
|
|
377
|
+
Max: 201
|
data/CHANGELOG.md
CHANGED
data/gitlab-fog-azure-rm.gemspec
CHANGED
|
@@ -15,18 +15,20 @@ Gem::Specification.new do |spec|
|
|
|
15
15
|
spec.homepage = 'https://gitlab.com/gitlab-org/gitlab-fog-azure-rm'
|
|
16
16
|
spec.rdoc_options = %w[--charset=UTF-8]
|
|
17
17
|
spec.extra_rdoc_files = %w[README.md]
|
|
18
|
-
spec.required_ruby_version = '>= 2.
|
|
18
|
+
spec.required_ruby_version = '>= 3.2.0'
|
|
19
19
|
spec.post_install_message = 'Thanks for installing!'
|
|
20
20
|
spec.add_development_dependency 'codeclimate-test-reporter' , '~> 1.0.0'
|
|
21
|
-
spec.add_development_dependency 'minitest', '~> 5.
|
|
21
|
+
spec.add_development_dependency 'minitest', '~> 5.27'
|
|
22
22
|
spec.add_development_dependency 'rake', '~> 13.0'
|
|
23
|
-
spec.add_development_dependency 'rubocop', '~>
|
|
23
|
+
spec.add_development_dependency 'rubocop', '~> 1.86.0'
|
|
24
24
|
spec.add_development_dependency 'simplecov'
|
|
25
|
+
spec.add_development_dependency 'timecop'
|
|
25
26
|
spec.add_development_dependency 'webmock'
|
|
26
27
|
spec.add_development_dependency 'webrick', '~> 1.8'
|
|
27
28
|
|
|
29
|
+
spec.add_dependency 'base64'
|
|
28
30
|
spec.add_dependency 'faraday', "~> 2.0"
|
|
29
|
-
spec.add_dependency "faraday-follow_redirects", "~> 0.
|
|
31
|
+
spec.add_dependency "faraday-follow_redirects", "~> 0.5.0"
|
|
30
32
|
spec.add_dependency "faraday-net_http_persistent", "~> 2.0"
|
|
31
33
|
spec.add_dependency 'fog-core', '~> 2.1'
|
|
32
34
|
spec.add_dependency 'fog-json', '~> 1.2'
|
|
@@ -114,7 +114,9 @@ module Azure
|
|
|
114
114
|
# @return [String] a string with the canonicalized resource.
|
|
115
115
|
def canonicalized_resource(uri)
|
|
116
116
|
resource = '/' + account_name + (uri.path.empty? ? '/' : uri.path)
|
|
117
|
-
params =
|
|
117
|
+
params = URI.decode_www_form(uri.query.to_s)
|
|
118
|
+
.each_with_object({}) { |(key, value), hash| (hash[key] ||= []) << value }
|
|
119
|
+
.map { |k,v| [k.downcase, v] }
|
|
118
120
|
params.sort_by! { |k,_| k }
|
|
119
121
|
params.map! { |k,v| '%s:%s' % [k, v.map(&:strip).sort.join(',')] }
|
|
120
122
|
[resource, *params].join("\n")
|
|
@@ -11,7 +11,6 @@ module Fog
|
|
|
11
11
|
def initialize(options)
|
|
12
12
|
@options = options
|
|
13
13
|
@credential_client = nil
|
|
14
|
-
@credentials = nil
|
|
15
14
|
end
|
|
16
15
|
|
|
17
16
|
def fetch_credentials_if_needed
|
|
@@ -37,7 +36,7 @@ module Fog
|
|
|
37
36
|
client = klass.new(options)
|
|
38
37
|
|
|
39
38
|
begin
|
|
40
|
-
credentials = client.
|
|
39
|
+
credentials = client.fetch_credentials_if_needed
|
|
41
40
|
rescue Fog::AzureRM::Identity::BaseClient::FetchCredentialsError
|
|
42
41
|
next
|
|
43
42
|
end
|
|
@@ -48,10 +47,7 @@ module Fog
|
|
|
48
47
|
end
|
|
49
48
|
end
|
|
50
49
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
@credentials = credentials
|
|
54
|
-
@credentials
|
|
50
|
+
@credential_client
|
|
55
51
|
end
|
|
56
52
|
end
|
|
57
53
|
end
|
|
@@ -18,9 +18,9 @@ module Fog
|
|
|
18
18
|
# This class provides the mock implementation for unit tests.
|
|
19
19
|
class Mock
|
|
20
20
|
def get_blob_url(_container_name, _blob_name, options = {})
|
|
21
|
-
url = 'https://mockaccount.blob.core.windows.net/test_container/test_blob'
|
|
21
|
+
url = +'https://mockaccount.blob.core.windows.net/test_container/test_blob'
|
|
22
22
|
url.sub!('https:', 'http:') if options[:scheme] == 'http'
|
|
23
|
-
url
|
|
23
|
+
url.freeze
|
|
24
24
|
end
|
|
25
25
|
end
|
|
26
26
|
end
|
|
@@ -24,9 +24,9 @@ module Fog
|
|
|
24
24
|
# This class provides the mock implementation for unit tests.
|
|
25
25
|
class Mock
|
|
26
26
|
def get_container_url(_container_name, options = {})
|
|
27
|
-
url = 'https://mockaccount.blob.core.windows.net/test_container?comp=list&restype=container'
|
|
27
|
+
url = +'https://mockaccount.blob.core.windows.net/test_container?comp=list&restype=container'
|
|
28
28
|
url.sub!('https:', 'http:') if options[:scheme] == 'http'
|
|
29
|
-
url
|
|
29
|
+
url.freeze
|
|
30
30
|
end
|
|
31
31
|
end
|
|
32
32
|
end
|
data/lib/fog/azurerm/storage.rb
CHANGED
|
@@ -100,6 +100,9 @@ module Fog
|
|
|
100
100
|
raise e.message
|
|
101
101
|
end
|
|
102
102
|
|
|
103
|
+
@user_delegation_key_mutex = Mutex.new
|
|
104
|
+
@blob_client_mutex = Mutex.new
|
|
105
|
+
|
|
103
106
|
options[:environment] = options[:environment] || ENV['AZURE_ENVIRONMENT'] || ENVIRONMENT_AZURE_CLOUD
|
|
104
107
|
@environment = options[:environment]
|
|
105
108
|
@options = options
|
|
@@ -114,24 +117,7 @@ module Fog
|
|
|
114
117
|
@azure_storage_endpoint = options[:azure_storage_endpoint]
|
|
115
118
|
@azure_storage_domain = options[:azure_storage_domain]
|
|
116
119
|
|
|
117
|
-
|
|
118
|
-
@azure_storage_endpoint ||
|
|
119
|
-
if @azure_storage_domain.nil? || @azure_storage_domain.empty?
|
|
120
|
-
get_blob_endpoint(@azure_storage_account_name, true, @environment)
|
|
121
|
-
else
|
|
122
|
-
get_blob_endpoint_with_domain(@azure_storage_account_name, true, @azure_storage_domain)
|
|
123
|
-
end
|
|
124
|
-
|
|
125
|
-
azure_client = Azure::Storage::Common::Client.create({
|
|
126
|
-
storage_account_name: @azure_storage_account_name,
|
|
127
|
-
storage_access_key: @azure_storage_access_key,
|
|
128
|
-
signer: @azure_storage_token_signer
|
|
129
|
-
}.compact)
|
|
130
|
-
azure_client.storage_blob_host = storage_blob_host
|
|
131
|
-
@blob_client = Azure::Storage::Blob::BlobService.new(client: azure_client, api_version: @api_version)
|
|
132
|
-
@blob_client.with_filter(Fog::AzureRM::IdentityEncodingFilter.new)
|
|
133
|
-
@blob_client.with_filter(Azure::Storage::Common::Core::Filter::ExponentialRetryPolicyFilter.new)
|
|
134
|
-
@blob_client.with_filter(Azure::Core::Http::DebugFilter.new) if @debug
|
|
120
|
+
refresh_blob_client
|
|
135
121
|
end
|
|
136
122
|
|
|
137
123
|
private
|
|
@@ -177,11 +163,16 @@ module Fog
|
|
|
177
163
|
return nil unless @azure_storage_token_signer
|
|
178
164
|
|
|
179
165
|
if @credential_client
|
|
180
|
-
|
|
181
|
-
|
|
166
|
+
new_credentials = @credential_client.fetch_credentials_if_needed
|
|
167
|
+
changed = new_credentials != @credentials
|
|
168
|
+
|
|
169
|
+
if changed
|
|
170
|
+
@credentials = new_credentials
|
|
171
|
+
@azure_storage_token_signer = token_signer
|
|
172
|
+
refresh_blob_client
|
|
173
|
+
end
|
|
182
174
|
end
|
|
183
175
|
|
|
184
|
-
@user_delegation_key_mutex ||= Mutex.new
|
|
185
176
|
@user_delegation_key_mutex.synchronize do
|
|
186
177
|
if @user_delegation_key_expiry.nil? || @user_delegation_key_expiry < requested_expiry
|
|
187
178
|
start = Time.now
|
|
@@ -197,6 +188,35 @@ module Fog
|
|
|
197
188
|
|
|
198
189
|
@user_delegation_key
|
|
199
190
|
end
|
|
191
|
+
|
|
192
|
+
def refresh_blob_client
|
|
193
|
+
@blob_client_mutex.synchronize do
|
|
194
|
+
azure_client = create_azure_client
|
|
195
|
+
azure_client.storage_blob_host = storage_blob_host
|
|
196
|
+
@blob_client = Azure::Storage::Blob::BlobService.new(client: azure_client, api_version: @api_version)
|
|
197
|
+
@blob_client.with_filter(Fog::AzureRM::IdentityEncodingFilter.new)
|
|
198
|
+
@blob_client.with_filter(Azure::Storage::Common::Core::Filter::ExponentialRetryPolicyFilter.new)
|
|
199
|
+
@blob_client.with_filter(Azure::Core::Http::DebugFilter.new) if @debug
|
|
200
|
+
end
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
def storage_blob_host
|
|
204
|
+
return @azure_storage_endpoint if @azure_storage_endpoint
|
|
205
|
+
|
|
206
|
+
if @azure_storage_domain.nil? || @azure_storage_domain.empty?
|
|
207
|
+
get_blob_endpoint(@azure_storage_account_name, true, @environment)
|
|
208
|
+
else
|
|
209
|
+
get_blob_endpoint_with_domain(@azure_storage_account_name, true, @azure_storage_domain)
|
|
210
|
+
end
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
def create_azure_client
|
|
214
|
+
Azure::Storage::Common::Client.create({
|
|
215
|
+
storage_account_name: @azure_storage_account_name,
|
|
216
|
+
storage_access_key: @azure_storage_access_key,
|
|
217
|
+
signer: @azure_storage_token_signer
|
|
218
|
+
}.compact)
|
|
219
|
+
end
|
|
200
220
|
end
|
|
201
221
|
end
|
|
202
222
|
end
|
data/lib/fog/azurerm/version.rb
CHANGED
|
@@ -49,7 +49,7 @@ class TestGetBlob < Minitest::Test
|
|
|
49
49
|
end
|
|
50
50
|
|
|
51
51
|
def test_get_blob_with_block_given_success
|
|
52
|
-
data = ''
|
|
52
|
+
data = +''
|
|
53
53
|
@blob_client.stub :get_blob_properties, @raw_cloud_blob do
|
|
54
54
|
@blob_client.stub :get_blob, @blob_with_content do
|
|
55
55
|
@service.get_blob('test_container', 'test_blob') do |chunk, _remaining_bytes, _total_bytes|
|
|
@@ -61,7 +61,7 @@ class TestGetBlob < Minitest::Test
|
|
|
61
61
|
end
|
|
62
62
|
|
|
63
63
|
def test_get_blob_with_block_given_with_emtpy_blob_success
|
|
64
|
-
data = ''
|
|
64
|
+
data = +''
|
|
65
65
|
empty_raw_cloud_blob = @raw_cloud_blob
|
|
66
66
|
empty_raw_cloud_blob.properties[:content_length] = 0
|
|
67
67
|
empty_blob_with_content = [
|
|
@@ -79,7 +79,7 @@ class TestGetBlob < Minitest::Test
|
|
|
79
79
|
end
|
|
80
80
|
|
|
81
81
|
def test_get_blob_with_block_given_with_emtpy_range_success
|
|
82
|
-
data = ''
|
|
82
|
+
data = +''
|
|
83
83
|
options = {
|
|
84
84
|
start_range: 1024,
|
|
85
85
|
end_range: 1024
|
|
@@ -132,7 +132,7 @@ class TestGetBlob < Minitest::Test
|
|
|
132
132
|
end
|
|
133
133
|
|
|
134
134
|
def test_get_blob_with_block_given_mock
|
|
135
|
-
data = ''
|
|
135
|
+
data = +''
|
|
136
136
|
@mock_service.get_blob('test_container', 'test_blob') do |chunk, _remaining_bytes, _total_bytes|
|
|
137
137
|
data << chunk
|
|
138
138
|
end
|
|
@@ -224,4 +224,74 @@ class TestGetBlobHttpsUrl < Minitest::Test
|
|
|
224
224
|
assert_equal "#{@url}?#{@token}", @mock_service.get_blob_https_url('test_container', 'test_blob', Time.now.utc + 3600)
|
|
225
225
|
assert_equal "#{@url}?#{@token}", @mock_service.get_object_url('test_container', 'test_blob', Time.now.utc + 3600)
|
|
226
226
|
end
|
|
227
|
+
|
|
228
|
+
def test_blob_client_refreshes_when_credentials_expire
|
|
229
|
+
# Setup an expired initial token
|
|
230
|
+
initial_token_response = {
|
|
231
|
+
'access_token' => 'initial_token',
|
|
232
|
+
'expires_on' => (Time.now + ::Fog::AzureRM::Identity::Credentials::EXPIRATION_BUFFER + 10).to_i
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
# Setup refreshed token response
|
|
236
|
+
refreshed_token_response = {
|
|
237
|
+
'access_token' => 'refreshed_token',
|
|
238
|
+
'expires_on' => (Time.now + ::Fog::AzureRM::Identity::Credentials::EXPIRATION_BUFFER * 3).to_i
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
# Mock the identity endpoint to return initial token first, then refreshed token
|
|
242
|
+
stub_request(:get, "#{Fog::AzureRM::Identity::IDENTITY_ENDPOINT}?api-version=#{Fog::AzureRM::Identity::API_VERSION}&resource=https://storage.azure.com")
|
|
243
|
+
.with(headers: { 'Metadata' => 'true' })
|
|
244
|
+
.to_return(
|
|
245
|
+
{ status: 200, body: initial_token_response.to_json },
|
|
246
|
+
{ status: 200, body: refreshed_token_response.to_json }
|
|
247
|
+
)
|
|
248
|
+
|
|
249
|
+
# Setup user delegation key responses
|
|
250
|
+
delegation_response = <<~MSG
|
|
251
|
+
<UserDelegationKey>
|
|
252
|
+
<SignedOid>f81d4fae-7dec-11d0-a765-00a0c91e6bf6</SignedOid>
|
|
253
|
+
<SignedTid>72f988bf-86f1-41af-91ab-2d7cd011db47</SignedTid>
|
|
254
|
+
<SignedStart>2024-09-19T00:00:00Z</SignedStart>
|
|
255
|
+
<SignedExpiry>2024-09-26T00:00:00Z</SignedExpiry>
|
|
256
|
+
<SignedService>b</SignedService>
|
|
257
|
+
<SignedVersion>2020-02-10</SignedVersion>
|
|
258
|
+
<Value>UDELEGATIONKEY_INITIAL</Value>
|
|
259
|
+
<SignedKey>rL7...INITIAL</SignedKey>
|
|
260
|
+
</UserDelegationKey>
|
|
261
|
+
MSG
|
|
262
|
+
|
|
263
|
+
stub_request(:post, 'https://mockaccount.blob.core.windows.net?comp=userdelegationkey&restype=service')
|
|
264
|
+
.to_return(
|
|
265
|
+
{ status: 200, headers: { 'Content-Type': 'application/xml' }, body: delegation_response }
|
|
266
|
+
)
|
|
267
|
+
|
|
268
|
+
service = Fog::AzureRM::Storage.new(storage_account_managed_identity)
|
|
269
|
+
initial_blob_client = service.instance_variable_get(:@blob_client)
|
|
270
|
+
refute_nil initial_blob_client
|
|
271
|
+
|
|
272
|
+
# First request should not refresh the blob client and token
|
|
273
|
+
requested_expiry = Time.now + 60
|
|
274
|
+
url1 = service.get_blob_https_url('test_container', 'test_blob', requested_expiry)
|
|
275
|
+
refute_nil url1
|
|
276
|
+
assert url1.include?('https://mockaccount.blob.core.windows.net/test_container/test_blob')
|
|
277
|
+
|
|
278
|
+
second_blob_client = service.instance_variable_get(:@blob_client)
|
|
279
|
+
assert_equal initial_blob_client.object_id, second_blob_client.object_id
|
|
280
|
+
|
|
281
|
+
Timecop.travel(Time.now + ::Fog::AzureRM::Identity::Credentials::EXPIRATION_BUFFER) do
|
|
282
|
+
credentials = service.instance_variable_get(:@credentials)
|
|
283
|
+
assert credentials.refresh_needed?
|
|
284
|
+
|
|
285
|
+
# Second request should tigger credential refresh and blob client update
|
|
286
|
+
url2 = service.get_blob_https_url('test_container', 'test_blob', requested_expiry)
|
|
287
|
+
third_blob_client = service.instance_variable_get(:@blob_client)
|
|
288
|
+
credentials = service.instance_variable_get(:@credentials)
|
|
289
|
+
refute credentials.refresh_needed?
|
|
290
|
+
|
|
291
|
+
refute_nil url2
|
|
292
|
+
assert url2.include?('https://mockaccount.blob.core.windows.net/test_container/test_blob')
|
|
293
|
+
refute_nil third_blob_client
|
|
294
|
+
refute_equal third_blob_client.object_id, second_blob_client.object_id
|
|
295
|
+
end
|
|
296
|
+
end
|
|
227
297
|
end
|
data/test/test_helper.rb
CHANGED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
require File.expand_path '../test_helper', __dir__
|
|
2
|
+
|
|
3
|
+
class TestCredentials < Minitest::Test
|
|
4
|
+
def setup
|
|
5
|
+
@token = 'test-access-token'
|
|
6
|
+
@expires_at = Time.now + 3600 # 1 hour from now
|
|
7
|
+
@credentials = Fog::AzureRM::Identity::Credentials.new(@token, @expires_at)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def test_initialize
|
|
11
|
+
assert_equal @token, @credentials.token
|
|
12
|
+
assert_equal @expires_at, @credentials.expires_at
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def test_refresh_needed_when_expires_at_is_nil
|
|
16
|
+
credentials = Fog::AzureRM::Identity::Credentials.new(@token, nil)
|
|
17
|
+
assert credentials.refresh_needed?
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def test_refresh_needed_when_token_expires_soon
|
|
21
|
+
# Token expires in 5 minutes (less than 10 minute buffer)
|
|
22
|
+
expires_soon = Time.now + 300
|
|
23
|
+
credentials = Fog::AzureRM::Identity::Credentials.new(@token, expires_soon)
|
|
24
|
+
assert credentials.refresh_needed?
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def test_refresh_not_needed_when_token_has_time_left
|
|
28
|
+
# Token expires in 15 minutes (more than 10 minute buffer)
|
|
29
|
+
expires_later = Time.now + 900
|
|
30
|
+
credentials = Fog::AzureRM::Identity::Credentials.new(@token, expires_later)
|
|
31
|
+
refute credentials.refresh_needed?
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def test_refresh_needed_exactly_at_buffer_time
|
|
35
|
+
# Token expires exactly at buffer time (10 minutes)
|
|
36
|
+
expires_at_buffer = Time.now + Fog::AzureRM::Identity::Credentials::EXPIRATION_BUFFER
|
|
37
|
+
credentials = Fog::AzureRM::Identity::Credentials.new(@token, expires_at_buffer)
|
|
38
|
+
assert credentials.refresh_needed?
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def test_expiration_buffer_constant
|
|
42
|
+
assert_equal 600, Fog::AzureRM::Identity::Credentials::EXPIRATION_BUFFER
|
|
43
|
+
end
|
|
44
|
+
end
|
|
@@ -9,7 +9,6 @@ class TestDefaultCredentials < Minitest::Test
|
|
|
9
9
|
def test_initialize
|
|
10
10
|
assert_instance_of Fog::AzureRM::DefaultCredentials, @default_credentials
|
|
11
11
|
assert_nil @default_credentials.instance_variable_get(:@credential_client)
|
|
12
|
-
assert_nil @default_credentials.instance_variable_get(:@credentials)
|
|
13
12
|
end
|
|
14
13
|
|
|
15
14
|
def test_fetch_credentials_if_needed_with_no_credential_client
|
|
@@ -28,70 +27,55 @@ class TestDefaultCredentials < Minitest::Test
|
|
|
28
27
|
end
|
|
29
28
|
|
|
30
29
|
def test_credential_client_with_workflow_identity
|
|
31
|
-
|
|
32
|
-
mock_workflow_client.expect :fetch_credentials, 'fake_workflow_credentials'
|
|
30
|
+
workflow_client = Struct.new(:fetch_credentials_if_needed).new('fake_workflow_credentials')
|
|
33
31
|
|
|
34
|
-
Fog::AzureRM::Identity::WorkflowIdentityClient.stub :new,
|
|
35
|
-
|
|
36
|
-
assert_equal
|
|
32
|
+
Fog::AzureRM::Identity::WorkflowIdentityClient.stub :new, workflow_client do
|
|
33
|
+
client = @default_credentials.send(:credential_client)
|
|
34
|
+
assert_equal workflow_client, client
|
|
35
|
+
assert_equal workflow_client, @default_credentials.instance_variable_get(:@credential_client)
|
|
37
36
|
end
|
|
38
|
-
|
|
39
|
-
mock_workflow_client.verify
|
|
40
37
|
end
|
|
41
38
|
|
|
42
39
|
def test_credential_client_with_managed_identity
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
credentials = @default_credentials.send(:credential_client)
|
|
52
|
-
assert_equal 'fake_managed_credentials', credentials
|
|
40
|
+
workflow_client = Struct.new(:fetch_credentials_if_needed).new
|
|
41
|
+
managed_client = Struct.new(:fetch_credentials_if_needed).new('fake_managed_credentials')
|
|
42
|
+
|
|
43
|
+
Fog::AzureRM::Identity::WorkflowIdentityClient.stub :new, workflow_client do
|
|
44
|
+
Fog::AzureRM::Identity::ManagedIdentityClient.stub :new, managed_client do
|
|
45
|
+
client = @default_credentials.send(:credential_client)
|
|
46
|
+
assert_equal managed_client, client
|
|
47
|
+
assert_equal managed_client, @default_credentials.instance_variable_get(:@credential_client)
|
|
53
48
|
end
|
|
54
49
|
end
|
|
55
|
-
|
|
56
|
-
mock_workflow_client.verify
|
|
57
|
-
mock_managed_client.verify
|
|
58
50
|
end
|
|
59
51
|
|
|
60
52
|
def test_credential_client_with_failed_workflow_identity
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
53
|
+
workflow_client = Class.new do
|
|
54
|
+
def fetch_credentials_if_needed
|
|
55
|
+
raise ::Fog::AzureRM::Identity::BaseClient::FetchCredentialsError, 'Failed to fetch credentials'
|
|
56
|
+
end
|
|
57
|
+
end.new
|
|
65
58
|
|
|
66
|
-
|
|
67
|
-
mock_managed_client.expect :fetch_credentials, 'fake_managed_credentials'
|
|
59
|
+
managed_client = Struct.new(:fetch_credentials_if_needed).new('fake_managed_credentials')
|
|
68
60
|
|
|
69
|
-
Fog::AzureRM::Identity::WorkflowIdentityClient.stub :new,
|
|
70
|
-
Fog::AzureRM::Identity::ManagedIdentityClient.stub :new,
|
|
71
|
-
|
|
72
|
-
assert_equal
|
|
61
|
+
Fog::AzureRM::Identity::WorkflowIdentityClient.stub :new, workflow_client do
|
|
62
|
+
Fog::AzureRM::Identity::ManagedIdentityClient.stub :new, managed_client do
|
|
63
|
+
client = @default_credentials.send(:credential_client)
|
|
64
|
+
assert_equal managed_client, client
|
|
65
|
+
assert_equal managed_client, @default_credentials.instance_variable_get(:@credential_client)
|
|
73
66
|
end
|
|
74
67
|
end
|
|
75
|
-
|
|
76
|
-
mock_workflow_client.verify
|
|
77
|
-
mock_managed_client.verify
|
|
78
68
|
end
|
|
79
69
|
|
|
80
70
|
def test_credential_client_with_no_credentials
|
|
81
|
-
|
|
82
|
-
|
|
71
|
+
workflow_client = Struct.new(:fetch_credentials_if_needed).new
|
|
72
|
+
managed_client = Struct.new(:fetch_credentials_if_needed).new
|
|
83
73
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
Fog::AzureRM::Identity::WorkflowIdentityClient.stub :new, mock_workflow_client do
|
|
88
|
-
Fog::AzureRM::Identity::ManagedIdentityClient.stub :new, mock_managed_client do
|
|
74
|
+
Fog::AzureRM::Identity::WorkflowIdentityClient.stub :new, workflow_client do
|
|
75
|
+
Fog::AzureRM::Identity::ManagedIdentityClient.stub :new, managed_client do
|
|
89
76
|
assert_nil @default_credentials.send(:credential_client)
|
|
90
77
|
assert_nil @default_credentials.instance_variable_get(:@credential_client)
|
|
91
78
|
end
|
|
92
79
|
end
|
|
93
|
-
|
|
94
|
-
mock_workflow_client.verify
|
|
95
|
-
mock_managed_client.verify
|
|
96
80
|
end
|
|
97
81
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: gitlab-fog-azure-rm
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.5.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Shaffan Chaudhry
|
|
@@ -15,9 +15,10 @@ authors:
|
|
|
15
15
|
- Azeem Sajid
|
|
16
16
|
- Maham Nazir
|
|
17
17
|
- Abbas Sheikh
|
|
18
|
+
autorequire:
|
|
18
19
|
bindir: bin
|
|
19
20
|
cert_chain: []
|
|
20
|
-
date:
|
|
21
|
+
date: 2026-03-31 00:00:00.000000000 Z
|
|
21
22
|
dependencies:
|
|
22
23
|
- !ruby/object:Gem::Dependency
|
|
23
24
|
name: codeclimate-test-reporter
|
|
@@ -39,14 +40,14 @@ dependencies:
|
|
|
39
40
|
requirements:
|
|
40
41
|
- - "~>"
|
|
41
42
|
- !ruby/object:Gem::Version
|
|
42
|
-
version: 5.
|
|
43
|
+
version: '5.27'
|
|
43
44
|
type: :development
|
|
44
45
|
prerelease: false
|
|
45
46
|
version_requirements: !ruby/object:Gem::Requirement
|
|
46
47
|
requirements:
|
|
47
48
|
- - "~>"
|
|
48
49
|
- !ruby/object:Gem::Version
|
|
49
|
-
version: 5.
|
|
50
|
+
version: '5.27'
|
|
50
51
|
- !ruby/object:Gem::Dependency
|
|
51
52
|
name: rake
|
|
52
53
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -67,14 +68,14 @@ dependencies:
|
|
|
67
68
|
requirements:
|
|
68
69
|
- - "~>"
|
|
69
70
|
- !ruby/object:Gem::Version
|
|
70
|
-
version:
|
|
71
|
+
version: 1.86.0
|
|
71
72
|
type: :development
|
|
72
73
|
prerelease: false
|
|
73
74
|
version_requirements: !ruby/object:Gem::Requirement
|
|
74
75
|
requirements:
|
|
75
76
|
- - "~>"
|
|
76
77
|
- !ruby/object:Gem::Version
|
|
77
|
-
version:
|
|
78
|
+
version: 1.86.0
|
|
78
79
|
- !ruby/object:Gem::Dependency
|
|
79
80
|
name: simplecov
|
|
80
81
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -89,6 +90,20 @@ dependencies:
|
|
|
89
90
|
- - ">="
|
|
90
91
|
- !ruby/object:Gem::Version
|
|
91
92
|
version: '0'
|
|
93
|
+
- !ruby/object:Gem::Dependency
|
|
94
|
+
name: timecop
|
|
95
|
+
requirement: !ruby/object:Gem::Requirement
|
|
96
|
+
requirements:
|
|
97
|
+
- - ">="
|
|
98
|
+
- !ruby/object:Gem::Version
|
|
99
|
+
version: '0'
|
|
100
|
+
type: :development
|
|
101
|
+
prerelease: false
|
|
102
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
103
|
+
requirements:
|
|
104
|
+
- - ">="
|
|
105
|
+
- !ruby/object:Gem::Version
|
|
106
|
+
version: '0'
|
|
92
107
|
- !ruby/object:Gem::Dependency
|
|
93
108
|
name: webmock
|
|
94
109
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -117,6 +132,20 @@ dependencies:
|
|
|
117
132
|
- - "~>"
|
|
118
133
|
- !ruby/object:Gem::Version
|
|
119
134
|
version: '1.8'
|
|
135
|
+
- !ruby/object:Gem::Dependency
|
|
136
|
+
name: base64
|
|
137
|
+
requirement: !ruby/object:Gem::Requirement
|
|
138
|
+
requirements:
|
|
139
|
+
- - ">="
|
|
140
|
+
- !ruby/object:Gem::Version
|
|
141
|
+
version: '0'
|
|
142
|
+
type: :runtime
|
|
143
|
+
prerelease: false
|
|
144
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
145
|
+
requirements:
|
|
146
|
+
- - ">="
|
|
147
|
+
- !ruby/object:Gem::Version
|
|
148
|
+
version: '0'
|
|
120
149
|
- !ruby/object:Gem::Dependency
|
|
121
150
|
name: faraday
|
|
122
151
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -137,14 +166,14 @@ dependencies:
|
|
|
137
166
|
requirements:
|
|
138
167
|
- - "~>"
|
|
139
168
|
- !ruby/object:Gem::Version
|
|
140
|
-
version: 0.
|
|
169
|
+
version: 0.5.0
|
|
141
170
|
type: :runtime
|
|
142
171
|
prerelease: false
|
|
143
172
|
version_requirements: !ruby/object:Gem::Requirement
|
|
144
173
|
requirements:
|
|
145
174
|
- - "~>"
|
|
146
175
|
- !ruby/object:Gem::Version
|
|
147
|
-
version: 0.
|
|
176
|
+
version: 0.5.0
|
|
148
177
|
- !ruby/object:Gem::Dependency
|
|
149
178
|
name: faraday-net_http_persistent
|
|
150
179
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -237,6 +266,7 @@ dependencies:
|
|
|
237
266
|
version: 1.10.8
|
|
238
267
|
description: This is a stripped-down fork of fog-azure-rm that enables Azure Blob
|
|
239
268
|
Storage to be used with CarrierWave and Fog.
|
|
269
|
+
email:
|
|
240
270
|
executables: []
|
|
241
271
|
extensions: []
|
|
242
272
|
extra_rdoc_files:
|
|
@@ -448,6 +478,7 @@ files:
|
|
|
448
478
|
- test/requests/storage/test_save_page_blob.rb
|
|
449
479
|
- test/requests/storage/test_wait_blob_copy_operation_to_finish.rb
|
|
450
480
|
- test/test_helper.rb
|
|
481
|
+
- test/unit/test_credentials.rb
|
|
451
482
|
- test/unit/test_default_credentials.rb
|
|
452
483
|
- test/unit/test_managed_identity_client.rb
|
|
453
484
|
- test/unit/test_shared_access_signature_generator.rb
|
|
@@ -465,14 +496,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
465
496
|
requirements:
|
|
466
497
|
- - ">="
|
|
467
498
|
- !ruby/object:Gem::Version
|
|
468
|
-
version: 2.
|
|
499
|
+
version: 3.2.0
|
|
469
500
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
470
501
|
requirements:
|
|
471
502
|
- - ">="
|
|
472
503
|
- !ruby/object:Gem::Version
|
|
473
504
|
version: '0'
|
|
474
505
|
requirements: []
|
|
475
|
-
rubygems_version: 3.
|
|
506
|
+
rubygems_version: 3.5.22
|
|
507
|
+
signing_key:
|
|
476
508
|
specification_version: 4
|
|
477
509
|
summary: Module for the 'fog' gem to support Azure Blob Storage with CarrierWave and
|
|
478
510
|
Fog.
|