Commit 4cd06867 authored by Jacob Vosmaer's avatar Jacob Vosmaer

Do not delete the SQL dump too early

The change in baa15792 broke backup
restore fucnctionality. This would not lead to data loss, but it
prevented the restore script from working. This bug exists only in
7.14.0 release candidate versions, not in 7.13.

Reported in https://github.com/gitlabhq/gitlabhq/issues/9571 .
parent 677bf661
...@@ -7,14 +7,15 @@ module Backup ...@@ -7,14 +7,15 @@ module Backup
def initialize def initialize
@config = YAML.load_file(File.join(Rails.root,'config','database.yml'))[Rails.env] @config = YAML.load_file(File.join(Rails.root,'config','database.yml'))[Rails.env]
@db_dir = File.join(Gitlab.config.backup.path, 'db') @db_dir = File.join(Gitlab.config.backup.path, 'db')
end
def dump
FileUtils.rm_rf(@db_dir) FileUtils.rm_rf(@db_dir)
# Ensure the parent dir of @db_dir exists # Ensure the parent dir of @db_dir exists
FileUtils.mkdir_p(Gitlab.config.backup.path) FileUtils.mkdir_p(Gitlab.config.backup.path)
# Fail if somebody raced to create @db_dir before us # Fail if somebody raced to create @db_dir before us
FileUtils.mkdir(@db_dir, mode: 0700) FileUtils.mkdir(@db_dir, mode: 0700)
end
def dump
success = case config["adapter"] success = case config["adapter"]
when /^mysql/ then when /^mysql/ then
$progress.print "Dumping MySQL database #{config['database']} ... " $progress.print "Dumping MySQL database #{config['database']} ... "
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment