summaryrefslogtreecommitdiff
path: root/lib/gitlab/import_export/saver.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/import_export/saver.rb')
-rw-r--r--lib/gitlab/import_export/saver.rb17
1 files changed, 10 insertions, 7 deletions
diff --git a/lib/gitlab/import_export/saver.rb b/lib/gitlab/import_export/saver.rb
index 634e58e6039..024a0e1e785 100644
--- a/lib/gitlab/import_export/saver.rb
+++ b/lib/gitlab/import_export/saver.rb
@@ -7,32 +7,35 @@ module Gitlab
new(*args).save
end
- def initialize(storage_path:)
- @storage_path = storage_path
+ def initialize(shared:)
+ @shared = shared
end
def save
if compress_and_save
- remove_storage_path
+ remove_@shared.storage_path
Rails.logger.info("Saved project export #{archive_file}")
archive_file
else
false
end
+ rescue => e
+ @shared.error(e.message)
+ false
end
private
def compress_and_save
- tar_czf(archive: archive_file, dir: @storage_path)
+ tar_czf(archive: archive_file, dir: @shared.storage_path)
end
- def remove_storage_path
- FileUtils.rm_rf(@storage_path)
+ def remove_shared.storage_path
+ FileUtils.rm_rf(@shared.storage_path)
end
def archive_file
- @archive_file ||= File.join(@storage_path, '..', "#{Time.now.strftime('%Y-%m-%d_%H-%M-%3N')}_project_export.tar.gz")
+ @archive_file ||= File.join(@shared.storage_path, '..', "#{Time.now.strftime('%Y-%m-%d_%H-%M-%3N')}_project_export.tar.gz")
end
end
end