summaryrefslogtreecommitdiff
path: root/lib/backup/manager.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/backup/manager.rb')
-rw-r--r--lib/backup/manager.rb10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/backup/manager.rb b/lib/backup/manager.rb
index 258a0fb2589..efaefa4ce44 100644
--- a/lib/backup/manager.rb
+++ b/lib/backup/manager.rb
@@ -1,5 +1,7 @@
module Backup
class Manager
+ BACKUP_CONTENTS = %w{repositories/ db/ uploads/ backup_information.yml}
+
def pack
# saving additional informations
s = {}
@@ -16,7 +18,7 @@ module Backup
# create archive
print "Creating backup archive: #{s[:backup_created_at].to_i}_gitlab_backup.tar ... "
- if Kernel.system("tar -cf #{s[:backup_created_at].to_i}_gitlab_backup.tar repositories/ db/ uploads/ backup_information.yml")
+ if Kernel.system('tar', '-cf', "#{s[:backup_created_at].to_i}_gitlab_backup.tar", *BACKUP_CONTENTS)
puts "done".green
else
puts "failed".red
@@ -25,7 +27,7 @@ module Backup
def cleanup
print "Deleting tmp directories ... "
- if Kernel.system("rm -rf repositories/ db/ uploads/ backup_information.yml")
+ if Kernel.system('rm', '-rf', *BACKUP_CONTENTS)
puts "done".green
else
puts "failed".red
@@ -44,7 +46,7 @@ module Backup
file_list.map! { |f| $1.to_i if f =~ /(\d+)_gitlab_backup.tar/ }
file_list.sort.each do |timestamp|
if Time.at(timestamp) < (Time.now - keep_time)
- if system("rm #{timestamp}_gitlab_backup.tar")
+ if Kernel.system(*%W(rm #{timestamp}_gitlab_backup.tar))
removed += 1
end
end
@@ -75,7 +77,7 @@ module Backup
end
print "Unpacking backup ... "
- unless Kernel.system("tar -xf #{tar_file}")
+ unless Kernel.system(*%W(tar -xf #{tar_file}))
puts "failed".red
exit 1
else