Module: ObjectStorage::MigrateUploadsWorker::Report

Included in:
ObjectStorage::MigrateUploadsWorker
Defined in:
app/workers/object_storage/migrate_uploads_worker.rb

Defined Under Namespace

Classes: MigrationFailures

Instance Method Summary collapse

Instance Method Details

#failures(failures) ⇒ Object


57
58
59
# File 'app/workers/object_storage/migrate_uploads_worker.rb', line 57

def failures(failures)
  failures.map { |f| "\t#{f}" }.join('\n')
end

#header(success, failures) ⇒ Object


53
54
55
# File 'app/workers/object_storage/migrate_uploads_worker.rb', line 53

def header(success, failures)
  _("Migrated %{success_count}/%{total_count} files.") % { success_count: success.count, total_count: success.count + failures.count }
end

#report!(results) ⇒ Object

Raises:


44
45
46
47
48
49
50
51
# File 'app/workers/object_storage/migrate_uploads_worker.rb', line 44

def report!(results)
  success, failures = results.partition(&:success?)

  Gitlab::AppLogger.info header(success, failures)
  Gitlab::AppLogger.warn failures(failures)

  raise MigrationFailures.new(failures.map(&:error)) if failures.any?
end