diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-11-19 10:00:58 +0000 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-11-19 10:00:58 +0000 |
commit | 5b30285407a050600c35145632d6901e81d94355 (patch) | |
tree | 79c72885cea50e329caf7368a69a5e7551a16f2e /lib | |
parent | caf1c9d85bb9df05b8e7f90e1a844fe8ecb5a857 (diff) | |
parent | bf3c0aafaa17c2e322d225180fd9708ec2827ac4 (diff) | |
download | gitlab-ce-5b30285407a050600c35145632d6901e81d94355.tar.gz |
Merge branch 'check_if_it_should_be_archived_in_backup' into 'master'
Check which folders and archives should be packed before passing to tar command.
If user uses backup task with SKIP and skips one of the archives listed(uploads, builds, artifacts) backup create will give an error: `Cannot stat: No such file or directory`.
This MR fixes that by checking for skipped items.
Additionally, compact everything to avoid `TypeError: no implicit conversion of nil into String` errors.
See merge request !1824
Diffstat (limited to 'lib')
-rw-r--r-- | lib/backup/manager.rb | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/lib/backup/manager.rb b/lib/backup/manager.rb index 9e15d5411a1..e7eda7c6f45 100644 --- a/lib/backup/manager.rb +++ b/lib/backup/manager.rb @@ -150,17 +150,15 @@ module Backup private def backup_contents - folders_to_backup + ["uploads.tar.gz", "builds.tar.gz", "artifacts.tar.gz", "backup_information.yml"] + folders_to_backup + archives_to_backup + ["backup_information.yml"] end - def folders_to_backup - folders = %w{repositories db} - - if ENV["SKIP"] - return folders.reject{ |folder| ENV["SKIP"].include?(folder) } - end + def archives_to_backup + %w{uploads builds artifacts}.map{ |name| (name + ".tar.gz") unless skipped?(name) }.compact + end - folders + def folders_to_backup + %w{repositories db}.reject{ |name| skipped?(name) } end def settings |