diff options
author | James Lopez <james@jameslopez.es> | 2016-06-24 10:50:23 +0200 |
---|---|---|
committer | James Lopez <james@jameslopez.es> | 2016-06-24 10:50:23 +0200 |
commit | 46b89a270f7eef15f6d8e41c79600795265054fb (patch) | |
tree | e842e005b4a24d52d3ab99e3d17ba51032c42de2 /lib/gitlab/import_export/importer.rb | |
parent | 4477dc249e563e60e126d4f5ad2692297a9584c1 (diff) | |
download | gitlab-ce-46b89a270f7eef15f6d8e41c79600795265054fb.tar.gz |
Fix tmp file being deleted after the request plus some cleanup and improved erroring for this situation
Diffstat (limited to 'lib/gitlab/import_export/importer.rb')
-rw-r--r-- | lib/gitlab/import_export/importer.rb | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/gitlab/import_export/importer.rb b/lib/gitlab/import_export/importer.rb index d209e04f7be..595b20a09bd 100644 --- a/lib/gitlab/import_export/importer.rb +++ b/lib/gitlab/import_export/importer.rb @@ -10,17 +10,22 @@ module Gitlab end def execute - Gitlab::ImportExport::FileImporter.import(archive_file: @archive_file, - shared: @shared) - if check_version! && [project_tree, repo_restorer, wiki_restorer, uploads_restorer].all?(&:restore) + if import_file && check_version! && [project_tree, repo_restorer, wiki_restorer, uploads_restorer].all?(&:restore) project_tree.restored_project else raise Projects::ImportService::Error.new(@shared.errors.join(', ')) end + + remove_import_file end private + def import_file + Gitlab::ImportExport::FileImporter.import(archive_file: @archive_file, + shared: @shared) + end + def check_version! Gitlab::ImportExport::VersionChecker.check!(shared: @shared) end @@ -59,6 +64,10 @@ module Gitlab def wiki_repo_path File.join(@shared.export_path, 'project.wiki.bundle') end + + def remove_import_file + FileUtils.rm_rf(@archive_file) + end end end end |