diff options
author | Rémy Coutable <remy@rymai.me> | 2019-01-17 21:02:44 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2019-01-17 21:02:44 +0300 |
commit | a71d8e19da723fe4fdd3c7d0ac7896c9d3130832 (patch) | |
tree | e7c89d89797cddc80ac80e1902360bbf0747bfd1 | |
parent | daae58d280ab61fce24d5353dd7f2f95be7eb3cc (diff) | |
parent | c74820db07f1f7348cd6fbe2a2d5307ba0e9eeba (diff) |
Merge branch 'backup_restore_fix_issue_46891' into 'master'
Modify file restore to rectify tar issue
See merge request gitlab-org/gitlab-ce!24000
-rw-r--r-- | changelogs/unreleased/backup_restore_fix_issue_46891.yml | 5 | ||||
-rw-r--r-- | lib/backup/files.rb | 10 |
2 files changed, 13 insertions, 2 deletions
diff --git a/changelogs/unreleased/backup_restore_fix_issue_46891.yml b/changelogs/unreleased/backup_restore_fix_issue_46891.yml new file mode 100644 index 00000000000..b8fe3b1b861 --- /dev/null +++ b/changelogs/unreleased/backup_restore_fix_issue_46891.yml @@ -0,0 +1,5 @@ +--- +title: Modify file restore to rectify tar issue +merge_request: 24000 +author: +type: fixed diff --git a/lib/backup/files.rb b/lib/backup/files.rb index 0032ae8f84b..2bac84846c5 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 |