Commit d7584f32 authored by Micaël Bergeron's avatar Micaël Bergeron

ensure the cleanup is run if the upload fails

parent 7525a79f
...@@ -3,6 +3,7 @@ class PseudonymizerWorker ...@@ -3,6 +3,7 @@ class PseudonymizerWorker
include CronjobQueue include CronjobQueue
def perform def perform
abort "The pseudonymizer is not available with this license." unless License.feature_available?(:pseudonymizer)
return unless Gitlab::CurrentSettings.pseudonymizer_enabled? return unless Gitlab::CurrentSettings.pseudonymizer_enabled?
options = Pseudonymizer::Options.new( options = Pseudonymizer::Options.new(
...@@ -11,10 +12,13 @@ class PseudonymizerWorker ...@@ -11,10 +12,13 @@ class PseudonymizerWorker
) )
dumper = Pseudonymizer::Dumper.new(options) dumper = Pseudonymizer::Dumper.new(options)
dumper.tables_to_csv
uploader = Pseudonymizer::Uploader.new(options, progress_output: File.open(File::NULL, "w")) uploader = Pseudonymizer::Uploader.new(options, progress_output: File.open(File::NULL, "w"))
uploader.upload
uploader.cleanup begin
dumper.tables_to_csv
uploader.upload
ensure
uploader.cleanup
end
end end
end end
...@@ -81,11 +81,14 @@ namespace :gitlab do ...@@ -81,11 +81,14 @@ namespace :gitlab do
) )
dumper = Pseudonymizer::Dumper.new(options) dumper = Pseudonymizer::Dumper.new(options)
dumper.tables_to_csv
uploader = Pseudonymizer::Uploader.new(options) uploader = Pseudonymizer::Uploader.new(options)
uploader.upload
uploader.cleanup begin
dumper.tables_to_csv
uploader.upload
ensure
uploader.cleanup
end
end end
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment