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
c18e8f58
Commit
c18e8f58
authored
Sep 07, 2017
by
James Edwards-Jones
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ObjectStoreUploader#migrate! uses with_callbacks to trigger verify_license!
parent
d0744566
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
11 deletions
+23
-11
app/uploaders/object_store_uploader.rb
app/uploaders/object_store_uploader.rb
+13
-11
spec/uploaders/object_store_uploader_spec.rb
spec/uploaders/object_store_uploader_spec.rb
+10
-0
No files found.
app/uploaders/object_store_uploader.rb
View file @
c18e8f58
...
...
@@ -106,18 +106,20 @@ class ObjectStoreUploader < CarrierWave::Uploader::Base
# change storage
self
.
object_store
=
new_store
storage
.
store!
(
file
).
tap
do
|
new_file
|
# since we change storage store the new storage
# in case of failure delete new file
begin
subject
.
save!
rescue
=>
e
new_file
.
delete
self
.
object_store
=
old_store
raise
e
with_callbacks
(
:store
,
file
)
do
storage
.
store!
(
file
).
tap
do
|
new_file
|
# since we change storage store the new storage
# in case of failure delete new file
begin
subject
.
save!
rescue
=>
e
new_file
.
delete
self
.
object_store
=
old_store
raise
e
end
old_file
.
delete
end
old_file
.
delete
end
end
...
...
spec/uploaders/object_store_uploader_spec.rb
View file @
c18e8f58
...
...
@@ -184,6 +184,16 @@ describe ObjectStoreUploader do
end
end
context
'when storage is unlicensed'
do
before
do
stub_artifacts_object_storage
(
licensed:
false
)
end
it
"raises an error"
do
expect
{
subject
}.
to
raise_error
(
/Object Storage feature is missing/
)
end
end
context
'when credentials are set'
do
before
do
stub_artifacts_object_storage
...
...
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