summaryrefslogtreecommitdiff
path: root/lib/backup/files.rb
diff options
context:
space:
mode:
authorJacob Vosmaer <contact@jacobvosmaer.nl>2015-10-16 17:16:17 +0200
committerJacob Vosmaer <contact@jacobvosmaer.nl>2015-10-16 17:16:17 +0200
commit58260a0327a953499a07e9cad8d9aaad2d25699b (patch)
tree8cb9e62b262a94955c63f0185539fd1e1fb572dc /lib/backup/files.rb
parentb847baf8c405935415fcd4ad4a620d577f6526f8 (diff)
downloadgitlab-ce-58260a0327a953499a07e9cad8d9aaad2d25699b.tar.gz
Do no rely on basename of builds, uploadsbackup-improvements
Diffstat (limited to 'lib/backup/files.rb')
-rw-r--r--lib/backup/files.rb9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/backup/files.rb b/lib/backup/files.rb
index 5a210a0e464..654b4d1c896 100644
--- a/lib/backup/files.rb
+++ b/lib/backup/files.rb
@@ -4,9 +4,9 @@ module Backup
class Files
attr_reader :name, :app_files_dir, :backup_tarball, :files_parent_dir
- def initialize(app_files_dir)
+ def initialize(name, app_files_dir)
+ @name = name
@app_files_dir = File.realpath(app_files_dir)
- @name = File.basename(app_files_dir)
@files_parent_dir = File.realpath(File.join(@app_files_dir, '..'))
@backup_tarball = File.join(Gitlab.config.backup.path, name + '.tar.gz')
end
@@ -15,13 +15,14 @@ module Backup
def dump
FileUtils.mkdir_p(Gitlab.config.backup.path)
FileUtils.rm_f(backup_tarball)
- run_pipeline!([%W(tar -C #{files_parent_dir} -cf - #{name}), %W(gzip -c -1)], out: [backup_tarball, 'w', 0600])
+ run_pipeline!([%W(tar -C #{app_files_dir} -cf - .), %W(gzip -c -1)], out: [backup_tarball, 'w', 0600])
end
def restore
backup_existing_files_dir
+ create_files_dir
- run_pipeline!([%W(gzip -cd), %W(tar -C #{files_parent_dir} -xf -)], in: backup_tarball)
+ run_pipeline!([%W(gzip -cd), %W(tar -C #{app_files_dir} -xf -)], in: backup_tarball)
end
def backup_existing_files_dir