summaryrefslogtreecommitdiff
path: root/lib/backup
diff options
context:
space:
mode:
authorFrederic Van Espen <fes@escaux.com>2019-03-07 11:14:27 +0100
committerFrederic Van Espen <fes@escaux.com>2019-03-07 11:14:27 +0100
commit31dfc31aaa227224152f200b9fb961404a08fa40 (patch)
tree69f8e54ecf7a7205df5277ae997f0b1d8158835c /lib/backup
parent562a1fc87d0269ce5fb1561fea45f8d01f4889de (diff)
parent5a75aa59dbafc8f0c25800f952df1e0aaa2d4dd5 (diff)
downloadgitlab-ce-31dfc31aaa227224152f200b9fb961404a08fa40.tar.gz
Merge branch 'master' into incremental-backups
Diffstat (limited to 'lib/backup')
-rw-r--r--lib/backup/files.rb10
-rw-r--r--lib/backup/manager.rb3
-rw-r--r--lib/backup/repository.rb2
3 files changed, 11 insertions, 4 deletions
diff --git a/lib/backup/files.rb b/lib/backup/files.rb
index 427c65e2d91..098f2da6d88 100644
--- a/lib/backup/files.rb
+++ b/lib/backup/files.rb
@@ -71,8 +71,14 @@ module Backup
end
def run_pipeline!(cmd_list, options = {})
- status_list = Open3.pipeline(*cmd_list, options)
- raise Backup::Error, 'Backup failed' unless status_list.compact.all?(&:success?)
+ err_r, err_w = IO.pipe
+ options[:err] = err_w
+ status = Open3.pipeline(*cmd_list, options)
+ err_w.close
+ return if status.compact.all?(&:success?)
+
+ regex = /^g?tar: \.: Cannot mkdir: No such file or directory$/
+ raise Backup::Error, 'Backup failed' unless err_r.read =~ regex
end
end
end
diff --git a/lib/backup/manager.rb b/lib/backup/manager.rb
index 12121920c67..aeaf61cda39 100644
--- a/lib/backup/manager.rb
+++ b/lib/backup/manager.rb
@@ -50,6 +50,7 @@ module Backup
if directory.files.create(key: remote_target, body: File.open(tar_file), public: false,
multipart_chunk_size: Gitlab.config.backup.upload.multipart_chunk_size,
encryption: Gitlab.config.backup.upload.encryption,
+ encryption_key: Gitlab.config.backup.upload.encryption_key,
storage_class: Gitlab.config.backup.upload.storage_class)
progress.puts "done".color(:green)
else
@@ -195,7 +196,7 @@ module Backup
if connection.service == ::Fog::Storage::Local
connection.directories.create(key: remote_directory)
else
- connection.directories.get(remote_directory)
+ connection.directories.new(key: remote_directory)
end
end
diff --git a/lib/backup/repository.rb b/lib/backup/repository.rb
index 184c7418e75..22ed1d8e7b4 100644
--- a/lib/backup/repository.rb
+++ b/lib/backup/repository.rb
@@ -93,7 +93,7 @@ module Backup
progress.puts "Error: #{e}".color(:red)
end
else
- restore_repo_success = gitlab_shell.create_repository(project.repository_storage, project.disk_path)
+ restore_repo_success = gitlab_shell.create_project_repository(project)
end
if restore_repo_success