Commit 1f9b3f2e93222d5b8d4a834ef8eb916786e87021
Exists in
spb-stable
and in
3 other branches
Merge branch 'backup_version' into 'master'
Less strict backup versions
Showing
1 changed file
with
10 additions
and
16 deletions
Show diff stats
lib/backup/manager.rb
... | ... | @@ -7,7 +7,7 @@ module Backup |
7 | 7 | s = {} |
8 | 8 | s[:db_version] = "#{ActiveRecord::Migrator.current_version}" |
9 | 9 | s[:backup_created_at] = Time.now |
10 | - s[:gitlab_version] = %x{git rev-parse HEAD}.gsub(/\n/,"") | |
10 | + s[:gitlab_version] = Gitlab::VERSION | |
11 | 11 | s[:tar_version] = %x{tar --version | head -1}.gsub(/\n/,"") |
12 | 12 | |
13 | 13 | Dir.chdir(Gitlab.config.backup.path) |
... | ... | @@ -87,21 +87,15 @@ module Backup |
87 | 87 | settings = YAML.load_file("backup_information.yml") |
88 | 88 | ENV["VERSION"] = "#{settings[:db_version]}" if settings[:db_version].to_i > 0 |
89 | 89 | |
90 | - # backups directory is not always sub of Rails root and able to execute the git rev-parse below | |
91 | - begin | |
92 | - Dir.chdir(Rails.root) | |
93 | - | |
94 | - # restoring mismatching backups can lead to unexpected problems | |
95 | - if settings[:gitlab_version] != %x{git rev-parse HEAD}.gsub(/\n/, "") | |
96 | - puts "GitLab version mismatch:".red | |
97 | - puts " Your current HEAD differs from the HEAD in the backup!".red | |
98 | - puts " Please switch to the following revision and try again:".red | |
99 | - puts " revision: #{settings[:gitlab_version]}".red | |
100 | - exit 1 | |
101 | - end | |
102 | - ensure | |
103 | - # chdir back to original intended dir | |
104 | - Dir.chdir(Gitlab.config.backup.path) | |
90 | + # restoring mismatching backups can lead to unexpected problems | |
91 | + if settings[:gitlab_version] != Gitlab::VERSION | |
92 | + puts "GitLab version mismatch:".red | |
93 | + puts " Your current GitLab version (#{Gitlab::VERSION}) differs from the GitLab version in the backup!".red | |
94 | + puts " Please switch to the following version and try again:".red | |
95 | + puts " version: #{settings[:gitlab_version]}".red | |
96 | + puts | |
97 | + puts "Hint: git checkout v#{settings[:gitlab_version]}" | |
98 | + exit 1 | |
105 | 99 | end |
106 | 100 | end |
107 | 101 | end | ... | ... |