2018-09-29 18:34:47 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-03-05 03:25:02 -05:00
|
|
|
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
|
2018-04-23 05:40:55 -04:00
|
|
|
|
|
|
|
def resource_busy_error(path)
|
|
|
|
message = <<~EOS
|
|
|
|
|
|
|
|
### NOTICE ###
|
|
|
|
As part of restore, the task tried to rename `#{path}` before restoring.
|
|
|
|
This could not be completed, perhaps `#{path}` is a mountpoint?
|
|
|
|
|
|
|
|
To complete the restore, please move the contents of `#{path}` to a
|
|
|
|
different location and run the restore task again.
|
|
|
|
|
|
|
|
EOS
|
|
|
|
raise message
|
|
|
|
end
|
2019-03-07 03:38:14 -05:00
|
|
|
|
|
|
|
def gzip_cmd
|
2019-03-07 03:51:53 -05:00
|
|
|
@gzip_cmd ||= if ENV['GZIP_RSYNCABLE'] == 'yes'
|
2019-03-07 03:38:14 -05:00
|
|
|
"gzip --rsyncable -c -1"
|
|
|
|
else
|
|
|
|
"gzip -c -1"
|
|
|
|
end
|
|
|
|
end
|
2018-03-05 03:25:02 -05:00
|
|
|
end
|
|
|
|
end
|