diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-26 21:09:24 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-26 21:09:24 +0300 |
commit | 619d0b6922a6cf95d291fbbf5fa3d09e772a1ea8 (patch) | |
tree | fb8f8e036cec1b32166206bb5102af6c5dca8cfe /app/services/projects | |
parent | 17ab40ca089e1aef61a83f77ab6df62a72f6ce06 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services/projects')
-rw-r--r-- | app/services/projects/import_export/export_service.rb | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/app/services/projects/import_export/export_service.rb b/app/services/projects/import_export/export_service.rb index 38859c1efa4..77fddc44085 100644 --- a/app/services/projects/import_export/export_service.rb +++ b/app/services/projects/import_export/export_service.rb @@ -14,6 +14,8 @@ module Projects save_all! execute_after_export_action(after_export_strategy) + ensure + cleanup end private @@ -24,7 +26,7 @@ module Projects return unless after_export_strategy unless after_export_strategy.execute(current_user, project) - cleanup_and_notify_error + notify_error end end @@ -33,7 +35,7 @@ module Projects Gitlab::ImportExport::Saver.save(exportable: project, shared: shared) notify_success else - cleanup_and_notify_error! + notify_error! end end @@ -54,7 +56,7 @@ module Projects end def project_tree_saver - Gitlab::ImportExport::ProjectTreeSaver.new(project: project, current_user: current_user, shared: shared, params: params) + Gitlab::ImportExport::Project::TreeSaver.new(project: project, current_user: current_user, shared: shared, params: params) end def uploads_saver @@ -73,16 +75,12 @@ module Projects Gitlab::ImportExport::LfsSaver.new(project: project, shared: shared) end - def cleanup_and_notify_error - Rails.logger.error("Import/Export - Project #{project.name} with ID: #{project.id} export error - #{shared.errors.join(', ')}") # rubocop:disable Gitlab/RailsLogger - - FileUtils.rm_rf(shared.export_path) - - notify_error + def cleanup + FileUtils.rm_rf(shared.archive_path) if shared&.archive_path end - def cleanup_and_notify_error! - cleanup_and_notify_error + def notify_error! + notify_error raise Gitlab::ImportExport::Error.new(shared.errors.to_sentence) end @@ -92,6 +90,8 @@ module Projects end def notify_error + Rails.logger.error("Import/Export - Project #{project.name} with ID: #{project.id} export error - #{shared.errors.join(', ')}") # rubocop:disable Gitlab/RailsLogger + notification_service.project_not_exported(project, current_user, shared.errors) end end |