Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
iv
gitlab-ce
Commits
1f9b3f2e
Commit
1f9b3f2e
authored
Feb 27, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'backup_version' into 'master'
Less strict backup versions
parents
0a963ee1
75f274b7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
16 deletions
+10
-16
lib/backup/manager.rb
lib/backup/manager.rb
+10
-16
No files found.
lib/backup/manager.rb
View file @
1f9b3f2e
...
@@ -7,7 +7,7 @@ module Backup
...
@@ -7,7 +7,7 @@ module Backup
s
=
{}
s
=
{}
s
[
:db_version
]
=
"
#{
ActiveRecord
::
Migrator
.
current_version
}
"
s
[
:db_version
]
=
"
#{
ActiveRecord
::
Migrator
.
current_version
}
"
s
[
:backup_created_at
]
=
Time
.
now
s
[
:backup_created_at
]
=
Time
.
now
s
[
:gitlab_version
]
=
%x{git rev-parse HEAD}
.
gsub
(
/\n/
,
""
)
s
[
:gitlab_version
]
=
Gitlab
::
VERSION
s
[
:tar_version
]
=
%x{tar --version | head -1}
.
gsub
(
/\n/
,
""
)
s
[
:tar_version
]
=
%x{tar --version | head -1}
.
gsub
(
/\n/
,
""
)
Dir
.
chdir
(
Gitlab
.
config
.
backup
.
path
)
Dir
.
chdir
(
Gitlab
.
config
.
backup
.
path
)
...
@@ -87,21 +87,15 @@ module Backup
...
@@ -87,21 +87,15 @@ module Backup
settings
=
YAML
.
load_file
(
"backup_information.yml"
)
settings
=
YAML
.
load_file
(
"backup_information.yml"
)
ENV
[
"VERSION"
]
=
"
#{
settings
[
:db_version
]
}
"
if
settings
[
:db_version
].
to_i
>
0
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
# restoring mismatching backups can lead to unexpected problems
begin
if
settings
[
:gitlab_version
]
!=
Gitlab
::
VERSION
Dir
.
chdir
(
Rails
.
root
)
puts
"GitLab version mismatch:"
.
red
puts
" Your current GitLab version (
#{
Gitlab
::
VERSION
}
) differs from the GitLab version in the backup!"
.
red
# restoring mismatching backups can lead to unexpected problems
puts
" Please switch to the following version and try again:"
.
red
if
settings
[
:gitlab_version
]
!=
%x{git rev-parse HEAD}
.
gsub
(
/\n/
,
""
)
puts
" version:
#{
settings
[
:gitlab_version
]
}
"
.
red
puts
"GitLab version mismatch:"
.
red
puts
puts
" Your current HEAD differs from the HEAD in the backup!"
.
red
puts
"Hint: git checkout v
#{
settings
[
:gitlab_version
]
}
"
puts
" Please switch to the following revision and try again:"
.
red
exit
1
puts
" revision:
#{
settings
[
:gitlab_version
]
}
"
.
red
exit
1
end
ensure
# chdir back to original intended dir
Dir
.
chdir
(
Gitlab
.
config
.
backup
.
path
)
end
end
end
end
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment