Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
2112aeb4
Commit
2112aeb4
authored
Oct 18, 2021
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up dynamic loading of object storage gems
parent
b221a58d
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
4 additions
and
67 deletions
+4
-67
config/initializers/direct_upload_support.rb
config/initializers/direct_upload_support.rb
+3
-7
lib/backup/manager.rb
lib/backup/manager.rb
+1
-3
lib/object_storage/config.rb
lib/object_storage/config.rb
+0
-10
spec/initializers/carrierwave_patch_spec.rb
spec/initializers/carrierwave_patch_spec.rb
+0
-3
spec/lib/object_storage/config_spec.rb
spec/lib/object_storage/config_spec.rb
+0
-40
spec/lib/object_storage/direct_upload_spec.rb
spec/lib/object_storage/direct_upload_spec.rb
+0
-4
No files found.
config/initializers/direct_upload_support.rb
View file @
2112aeb4
...
...
@@ -17,7 +17,7 @@ class DirectUploadsValidator
raise
ValidationError
,
"No provider configured for '
#{
uploader_type
}
'.
#{
supported_provider_text
}
"
if
provider
.
blank?
return
if
provider_
load
ed?
(
provider
)
return
if
provider_
support
ed?
(
provider
)
raise
ValidationError
,
"Object storage provider '
#{
provider
}
' is not supported "
\
"when 'direct_upload' is used for '
#{
uploader_type
}
'.
#{
supported_provider_text
}
"
...
...
@@ -25,12 +25,8 @@ class DirectUploadsValidator
private
def
provider_loaded?
(
provider
)
return
false
unless
SUPPORTED_DIRECT_UPLOAD_PROVIDERS
.
include?
(
provider
)
require
'fog/azurerm'
if
provider
==
ObjectStorage
::
Config
::
AZURE_PROVIDER
true
def
provider_supported?
(
provider
)
SUPPORTED_DIRECT_UPLOAD_PROVIDERS
.
include?
(
provider
)
end
def
supported_provider_text
...
...
lib/backup/manager.rb
View file @
2112aeb4
...
...
@@ -210,9 +210,7 @@ module Backup
def
object_storage_config
@object_storage_config
||=
begin
config
=
ObjectStorage
::
Config
.
new
(
Gitlab
.
config
.
backup
.
upload
)
config
.
load_provider
config
ObjectStorage
::
Config
.
new
(
Gitlab
.
config
.
backup
.
upload
)
end
end
...
...
lib/object_storage/config.rb
View file @
2112aeb4
...
...
@@ -12,16 +12,6 @@ module ObjectStorage
@options
=
options
.
to_hash
.
deep_symbolize_keys
end
def
load_provider
if
aws?
require
'fog/aws'
elsif
google?
require
'fog/google'
elsif
azure?
require
'fog/azurerm'
end
end
def
credentials
@credentials
||=
options
[
:connection
]
||
{}
end
...
...
spec/initializers/carrierwave_patch_spec.rb
View file @
2112aeb4
...
...
@@ -15,9 +15,6 @@ RSpec.describe 'CarrierWave::Storage::Fog::File' do
subject
{
CarrierWave
::
Storage
::
Fog
::
File
.
new
(
uploader
,
storage
,
test_filename
)
}
before
do
require
'fog/azurerm'
require
'fog/aws'
stub_object_storage
(
connection_params:
connection_options
,
remote_directory:
bucket_name
)
allow
(
uploader
).
to
receive
(
:fog_directory
).
and_return
(
bucket_name
)
...
...
spec/lib/object_storage/config_spec.rb
View file @
2112aeb4
...
...
@@ -36,46 +36,6 @@ RSpec.describe ObjectStorage::Config do
subject
{
described_class
.
new
(
raw_config
.
as_json
)
}
describe
'#load_provider'
do
before
do
subject
.
load_provider
end
context
'with AWS'
do
it
'registers AWS as a provider'
do
expect
(
Fog
.
providers
.
keys
).
to
include
(
:aws
)
end
end
context
'with Google'
do
let
(
:credentials
)
do
{
provider:
'Google'
,
google_storage_access_key_id:
'GOOGLE_ACCESS_KEY_ID'
,
google_storage_secret_access_key:
'GOOGLE_SECRET_ACCESS_KEY'
}
end
it
'registers Google as a provider'
do
expect
(
Fog
.
providers
.
keys
).
to
include
(
:google
)
end
end
context
'with Azure'
do
let
(
:credentials
)
do
{
provider:
'AzureRM'
,
azure_storage_account_name:
'azuretest'
,
azure_storage_access_key:
'ABCD1234'
}
end
it
'registers AzureRM as a provider'
do
expect
(
Fog
.
providers
.
keys
).
to
include
(
:azurerm
)
end
end
end
describe
'#credentials'
do
it
{
expect
(
subject
.
credentials
).
to
eq
(
credentials
)
}
end
...
...
spec/lib/object_storage/direct_upload_spec.rb
View file @
2112aeb4
...
...
@@ -201,10 +201,6 @@ RSpec.describe ObjectStorage::DirectUpload do
end
shared_examples
'a valid AzureRM upload'
do
before
do
require
'fog/azurerm'
end
it_behaves_like
'a valid upload'
it
'enables the Workhorse client'
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment