diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2017-09-12 12:39:21 +0300 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2018-02-28 22:39:30 +0300 |
commit | ec72abf53fd82ca3e7f126536a83b27b368696ec (patch) | |
tree | c9ce3610b5a48b635be375c5aea6abb9be12d162 /app | |
parent | 965dc28691e2d70b7040e28d90ccbc3721a9e416 (diff) |
Merge branch 'jej/object-storage-uploader-migrate-with-license-callback' into 'master'
ObjectStoreUploader#migrate! uses with_callbacks to trigger verify_license!
Closes #3370
See merge request !2863
Diffstat (limited to 'app')
-rw-r--r-- | app/uploaders/object_store_uploader.rb | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/app/uploaders/object_store_uploader.rb b/app/uploaders/object_store_uploader.rb index 3a742d4f715..9b9f47d5943 100644 --- a/app/uploaders/object_store_uploader.rb +++ b/app/uploaders/object_store_uploader.rb @@ -94,18 +94,20 @@ class ObjectStoreUploader < GitlabUploader # 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 |