Skip to content
Snippets Groups Projects
Commit 5f4fea17 authored by Angus MacArthur's avatar Angus MacArthur
Browse files

Correction to restore expected current directory

parent 9c82bca5
No related branches found
No related tags found
1 merge request!4140fixes for gitlab restore with non-standard backup and repo dirs
Loading
Loading
@@ -91,15 +91,20 @@ namespace :gitlab do
ENV["VERSION"] = "#{settings[:db_version]}" if settings[:db_version].to_i > 0
 
# backups directory is not always sub of Rails root and able to execute the git rev-parse below
Dir.chdir(Rails.root)
# restoring mismatching backups can lead to unexpected problems
if settings[:gitlab_version] != %x{git rev-parse HEAD}.gsub(/\n/,"")
puts "GitLab version mismatch:".red
puts " Your current HEAD differs from the HEAD in the backup!".red
puts " Please switch to the following revision and try again:".red
puts " revision: #{settings[:gitlab_version]}".red
exit 1
begin
Dir.chdir(Rails.root)
# restoring mismatching backups can lead to unexpected problems
if settings[:gitlab_version] != %x{git rev-parse HEAD}.gsub(/\n/, "")
puts "GitLab version mismatch:".red
puts " Your current HEAD differs from the HEAD in the backup!".red
puts " Please switch to the following revision and try again:".red
puts " revision: #{settings[:gitlab_version]}".red
exit 1
end
ensure
# chdir back to original intended dir
Dir.chdir(Gitlab.config.backup.path)
end
 
Rake::Task["gitlab:backup:db:restore"].invoke
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment