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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
12e373af
Commit
12e373af
authored
Mar 04, 2020
by
Henrik Christian Grove
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Less changes to #unpack
parent
c8794ec4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
15 deletions
+21
-15
lib/backup/manager.rb
lib/backup/manager.rb
+21
-15
No files found.
lib/backup/manager.rb
View file @
12e373af
...
...
@@ -125,25 +125,19 @@ module Backup
end
def
unpack
Dir
.
chdir
(
backup_path
)
do
if
ENV
[
'BACKUP'
].
present?
# User has indicated which backup to restore
tar_file
=
File
.
basename
(
ENV
[
'BACKUP'
])
+
FILE_NAME_SUFFIX
if
ENV
[
'BACKUP'
].
blank?
&&
non_tarred_backup?
progress
.
puts
"Non tarred backup found in
#{
backup_path
}
, using that"
unless
File
.
exist?
(
tar_file
)
progress
.
puts
"The backup file
#{
tar_file
}
does not exist!"
exit
1
return
false
end
Dir
.
chdir
(
backup_path
)
do
# check for existing backups in the backup dir
elsif
File
.
exist?
(
File
.
join
(
backup_path
,
'backup_information.yml'
))
progress
.
puts
"Non tarred backup found in
#{
backup_path
}
, using that"
break
false
elsif
backup_file_list
.
empty?
if
backup_file_list
.
empty?
progress
.
puts
"No backups found in
#{
backup_path
}
"
progress
.
puts
"Please make sure that file name ends with
#{
FILE_NAME_SUFFIX
}
"
exit
1
elsif
backup_file_list
.
many?
elsif
backup_file_list
.
many?
&&
ENV
[
"BACKUP"
].
nil?
progress
.
puts
'Found more than one backup:'
# print list of available backups
progress
.
puts
" "
+
available_timestamps
.
join
(
"
\n
"
)
...
...
@@ -152,7 +146,16 @@ module Backup
exit
1
end
tar_file
=
backup_file_list
.
first
tar_file
=
if
ENV
[
'BACKUP'
].
present?
File
.
basename
(
ENV
[
'BACKUP'
])
+
FILE_NAME_SUFFIX
else
backup_file_list
.
first
end
unless
File
.
exist?
(
tar_file
)
progress
.
puts
"The backup file
#{
tar_file
}
does not exist!"
exit
1
end
progress
.
print
'Unpacking backup ... '
...
...
@@ -163,7 +166,6 @@ module Backup
exit
1
end
end
true
end
def
tar_version
...
...
@@ -177,6 +179,10 @@ module Backup
private
def
non_tarred_backup?
File
.
exist?
(
File
.
join
(
backup_path
,
'backup_information.yml'
))
end
def
backup_path
Gitlab
.
config
.
backup
.
path
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