summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMicaël Bergeron <mbergeron@gitlab.com>2018-03-30 08:52:37 -0400
committerMicaël Bergeron <mbergeron@gitlab.com>2018-03-30 08:52:37 -0400
commit5b38fba4bf072bb254b9140024f11202d107d6b4 (patch)
tree2e7294480e44844b07c5217453429690b6036d22
parent29d06c59511b51084bc3130be578c47c5c5d91b9 (diff)
downloadgitlab-ce-44776-fix-upload-migrate-fails-for-group.tar.gz
-rw-r--r--app/workers/object_storage/migrate_uploads_worker.rb16
1 files changed, 15 insertions, 1 deletions
diff --git a/app/workers/object_storage/migrate_uploads_worker.rb b/app/workers/object_storage/migrate_uploads_worker.rb
index 826618aebdb..a6b2c251254 100644
--- a/app/workers/object_storage/migrate_uploads_worker.rb
+++ b/app/workers/object_storage/migrate_uploads_worker.rb
@@ -159,7 +159,11 @@ module ObjectStorage
raise(SanityCheckError, "Mount point #{mounted_as} not found in #{model_class}.") unless model_has_mount
end
- def perform(ids, model_type, mounted_as, to_store)
+ def perform(*args)
+ args_check!(args)
+
+ (ids, model_type, mounted_as, to_store) = args
+
@model_class = model_type.constantize
@mounted_as = mounted_as&.to_sym
@to_store = to_store
@@ -179,6 +183,16 @@ module ObjectStorage
self.class.sanity_check!(uploads, @model_class, @mounted_as)
end
+ def args_check!(args)
+ return if args.count == 4
+
+ case args.count
+ when 3 then raise SanityCheckError, "Job is missing the `model_type` argument."
+ else
+ raise SanityCheckError, "Job has wrong arguments format."
+ end
+ end
+
def build_uploaders(uploads)
uploads.map { |upload| upload.build_uploader(@mounted_as) }
end