summaryrefslogtreecommitdiff
path: root/lib/gitlab/import_export/file_importer.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-12-20 09:07:57 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-12-20 09:07:57 +0000
commit7881eb30eaa8b01dbcfe87faa09927c75c7d6e45 (patch)
tree298bc8d2c62b2f2c29cb8ecbcf3de3eaaa6466d9 /lib/gitlab/import_export/file_importer.rb
parent64b66e0cb6d1bfd27abf24e06653f00bddb60597 (diff)
downloadgitlab-ce-7881eb30eaa8b01dbcfe87faa09927c75c7d6e45.tar.gz
Add latest changes from gitlab-org/gitlab@12-6-stable-ee
Diffstat (limited to 'lib/gitlab/import_export/file_importer.rb')
-rw-r--r--lib/gitlab/import_export/file_importer.rb12
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/gitlab/import_export/file_importer.rb b/lib/gitlab/import_export/file_importer.rb
index 2fd12e3aa78..9d04d55770d 100644
--- a/lib/gitlab/import_export/file_importer.rb
+++ b/lib/gitlab/import_export/file_importer.rb
@@ -5,6 +5,8 @@ module Gitlab
class FileImporter
include Gitlab::ImportExport::CommandLineUtil
+ ImporterError = Class.new(StandardError)
+
MAX_RETRIES = 8
IGNORED_FILENAMES = %w(. ..).freeze
@@ -12,8 +14,8 @@ module Gitlab
new(*args).import
end
- def initialize(project:, archive_file:, shared:)
- @project = project
+ def initialize(importable:, archive_file:, shared:)
+ @importable = importable
@archive_file = archive_file
@shared = shared
end
@@ -52,7 +54,7 @@ module Gitlab
def decompress_archive
result = untar_zxf(archive: @archive_file, dir: @shared.export_path)
- raise Projects::ImportService::Error.new("Unable to decompress #{@archive_file} into #{@shared.export_path}") unless result
+ raise ImporterError.new("Unable to decompress #{@archive_file} into #{@shared.export_path}") unless result
result
end
@@ -60,9 +62,9 @@ module Gitlab
def copy_archive
return if @archive_file
- @archive_file = File.join(@shared.archive_path, Gitlab::ImportExport.export_filename(exportable: @project))
+ @archive_file = File.join(@shared.archive_path, Gitlab::ImportExport.export_filename(exportable: @importable))
- download_or_copy_upload(@project.import_export_upload.import_file, @archive_file)
+ download_or_copy_upload(@importable.import_export_upload.import_file, @archive_file)
end
def remove_symlinks