diff options
author | Jacob Vosmaer <contact@jacobvosmaer.nl> | 2015-07-06 18:43:17 +0200 |
---|---|---|
committer | Jacob Vosmaer <contact@jacobvosmaer.nl> | 2015-07-06 18:43:17 +0200 |
commit | bb50b7fcd0161a7b9f0f87cb395e355a87a9dd17 (patch) | |
tree | 51117e68ca045edf22012e79cd1efc99d3f0254f /lib/backup | |
parent | 17446ff0c98e870f0500279983432e5115e060a4 (diff) | |
download | gitlab-ce-bb50b7fcd0161a7b9f0f87cb395e355a87a9dd17.tar.gz |
Allow custom backup archive permissions
This change helps system administrators who want to replicate
GitLab backup files without needing root permissions.
Diffstat (limited to 'lib/backup')
-rw-r--r-- | lib/backup/manager.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/backup/manager.rb b/lib/backup/manager.rb index 6fa2079d1a8..5103b265ed4 100644 --- a/lib/backup/manager.rb +++ b/lib/backup/manager.rb @@ -20,14 +20,14 @@ module Backup # create archive $progress.print "Creating backup archive: #{tar_file} ... " - orig_umask = File.umask(0077) - if Kernel.system('tar', '-cf', tar_file, *backup_contents) + # Set file permissions on open to prevent chmod races. + tar_system_options = {out: [tar_file, 'w', Gitlab.config.backup.archive_permissions]} + if Kernel.system('tar', '-cf', '-', *backup_contents, tar_system_options) $progress.puts "done".green else puts "creating archive #{tar_file} failed".red abort 'Backup failed' end - File.umask(orig_umask) upload(tar_file) end |