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
Léo-Paul Géneau
gitlab-ce
Commits
f03df228
Commit
f03df228
authored
Jun 08, 2016
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only create the backup directory if it is local
Closes #12710
parent
9c96074c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
3 deletions
+18
-3
lib/backup/manager.rb
lib/backup/manager.rb
+18
-3
No files found.
lib/backup/manager.rb
View file @
f03df228
...
@@ -38,7 +38,6 @@ module Backup
...
@@ -38,7 +38,6 @@ module Backup
end
end
def
upload
(
tar_file
)
def
upload
(
tar_file
)
remote_directory
=
Gitlab
.
config
.
backup
.
upload
.
remote_directory
$progress
.
print
"Uploading backup archive to remote storage
#{
remote_directory
}
... "
$progress
.
print
"Uploading backup archive to remote storage
#{
remote_directory
}
... "
connection_settings
=
Gitlab
.
config
.
backup
.
upload
.
connection
connection_settings
=
Gitlab
.
config
.
backup
.
upload
.
connection
...
@@ -47,8 +46,7 @@ module Backup
...
@@ -47,8 +46,7 @@ module Backup
return
return
end
end
connection
=
::
Fog
::
Storage
.
new
(
connection_settings
)
directory
=
connect_to_remote_directory
(
connection_settings
)
directory
=
connection
.
directories
.
create
(
key:
remote_directory
)
if
directory
.
files
.
create
(
key:
tar_file
,
body:
File
.
open
(
tar_file
),
public:
false
,
if
directory
.
files
.
create
(
key:
tar_file
,
body:
File
.
open
(
tar_file
),
public:
false
,
multipart_chunk_size:
Gitlab
.
config
.
backup
.
upload
.
multipart_chunk_size
,
multipart_chunk_size:
Gitlab
.
config
.
backup
.
upload
.
multipart_chunk_size
,
...
@@ -155,6 +153,23 @@ module Backup
...
@@ -155,6 +153,23 @@ module Backup
private
private
def
connect_to_remote_directory
(
connection_settings
)
connection
=
::
Fog
::
Storage
.
new
(
connection_settings
)
# We only attempt to create the directory for local backups. For AWS
# and other cloud providers, we cannot guarantee the user will have
# permission to create the bucket.
if
connection
.
service
==
::
Fog
::
Storage
::
Local
connection
.
directories
.
create
(
key:
remote_directory
)
else
connection
.
directories
.
get
(
remote_directory
)
end
end
def
remote_directory
Gitlab
.
config
.
backup
.
upload
.
remote_directory
end
def
backup_contents
def
backup_contents
folders_to_backup
+
archives_to_backup
+
[
"backup_information.yml"
]
folders_to_backup
+
archives_to_backup
+
[
"backup_information.yml"
]
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