summaryrefslogtreecommitdiff
path: root/lib/backup/helper.rb
diff options
context:
space:
mode:
authorBalasankar "Balu" C <balasankar@gitlab.com>2018-03-05 13:55:02 +0530
committerBalasankar "Balu" C <balasankar@gitlab.com>2018-03-30 11:38:36 +0530
commit8785f237959a1e59fee8f628b76e476040848e24 (patch)
tree6becf45dd48e0ccc7fa45611af9376556637b2da /lib/backup/helper.rb
parent9b76d8512a5491202e5a953950cc815be9536648 (diff)
downloadgitlab-ce-8785f237959a1e59fee8f628b76e476040848e24.tar.gz
Move existing dirs to a temp location while restore
Instead of renaming existing storage directories to a timestamped format, create a timestamped directory in a temporary location and move the individual files and folders inside storage directories to it. This helps us with nested storage directories.
Diffstat (limited to 'lib/backup/helper.rb')
-rw-r--r--lib/backup/helper.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/backup/helper.rb b/lib/backup/helper.rb
new file mode 100644
index 00000000000..a1ee0faefe9
--- /dev/null
+++ b/lib/backup/helper.rb
@@ -0,0 +1,17 @@
+module Backup
+ module Helper
+ def access_denied_error(path)
+ message = <<~EOS
+
+ ### NOTICE ###
+ As part of restore, the task tried to move existing content from #{path}.
+ However, it seems that directory contains files/folders that are not owned
+ by the user #{Gitlab.config.gitlab.user}. To proceed, please move the files
+ or folders inside #{path} to a secure location so that #{path} is empty and
+ run restore task again.
+
+ EOS
+ raise message
+ end
+ end
+end