Class: Projects::ImportExport::RelationExportService
- Inherits:
-
Object
- Object
- Projects::ImportExport::RelationExportService
- Includes:
- Gitlab::ImportExport::CommandLineUtil
- Defined in:
- app/services/projects/import_export/relation_export_service.rb
Constant Summary
Constants included from Gitlab::ImportExport::CommandLineUtil
Gitlab::ImportExport::CommandLineUtil::CLEAN_DIR_IGNORE_FILE_NAMES, Gitlab::ImportExport::CommandLineUtil::CommandLineUtilError, Gitlab::ImportExport::CommandLineUtil::DEFAULT_DIR_MODE, Gitlab::ImportExport::CommandLineUtil::FileOversizedError, Gitlab::ImportExport::CommandLineUtil::HardLinkError, Gitlab::ImportExport::CommandLineUtil::UNTAR_MASK
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(relation_export, jid) ⇒ RelationExportService
constructor
A new instance of RelationExportService.
Methods included from Gitlab::ImportExport::CommandLineUtil
#gunzip, #gzip, #gzip_with_options, #mkdir_p, #tar_cf, #tar_czf, #untar_xf, #untar_zxf
Constructor Details
#initialize(relation_export, jid) ⇒ RelationExportService
Returns a new instance of RelationExportService.
8 9 10 11 12 |
# File 'app/services/projects/import_export/relation_export_service.rb', line 8 def initialize(relation_export, jid) @relation_export = relation_export @jid = jid @logger = Gitlab::Export::Logger.build end |
Instance Method Details
#execute ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'app/services/projects/import_export/relation_export_service.rb', line 14 def execute relation_export.update!(status_event: :start, jid: jid) mkdir_p(shared.export_path) mkdir_p(shared.archive_path) if relation_saver.save compress_export_path upload_compressed_file relation_export.finish! else fail_export(shared.errors.join(', ')) end rescue StandardError => e fail_export(e.) ensure FileUtils.remove_entry(shared.export_path) if File.exist?(shared.export_path) FileUtils.remove_entry(shared.archive_path) if File.exist?(shared.archive_path) end |