diff options
author | Bob Van Landuyt <bob@vanlanduyt.co> | 2018-04-23 11:40:55 +0200 |
---|---|---|
committer | Bob Van Landuyt <bob@vanlanduyt.co> | 2018-04-23 17:24:29 +0200 |
commit | e3ff928c753447bfad33ff3facd51bfde3e32878 (patch) | |
tree | 5fc4ac96afb56aca565d15121d0b525bc135ce45 /lib/backup | |
parent | effda09e06997f3b800e56617e1200cf795b890d (diff) | |
download | gitlab-ce-e3ff928c753447bfad33ff3facd51bfde3e32878.tar.gz |
Describe workaround when restore fails because of `Errno::EBUSY`
When `Errno::EBUSY` is raised during restore, this could indicate that
the directory being restored into is a mountpoint. In this case we
explain the user how to retry the restore.
Diffstat (limited to 'lib/backup')
-rw-r--r-- | lib/backup/files.rb | 2 | ||||
-rw-r--r-- | lib/backup/helper.rb | 14 | ||||
-rw-r--r-- | lib/backup/repository.rb | 2 |
3 files changed, 18 insertions, 0 deletions
diff --git a/lib/backup/files.rb b/lib/backup/files.rb index 88cb7e7b5a4..9895db9e451 100644 --- a/lib/backup/files.rb +++ b/lib/backup/files.rb @@ -53,6 +53,8 @@ module Backup FileUtils.mv(files, timestamped_files_path) rescue Errno::EACCES access_denied_error(app_files_dir) + rescue Errno::EBUSY + resource_busy_error(app_files_dir) end end end diff --git a/lib/backup/helper.rb b/lib/backup/helper.rb index a1ee0faefe9..54b9ce10b4d 100644 --- a/lib/backup/helper.rb +++ b/lib/backup/helper.rb @@ -13,5 +13,19 @@ module Backup EOS raise message end + + 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 end end diff --git a/lib/backup/repository.rb b/lib/backup/repository.rb index 89e3f1d9076..65e06fd78c0 100644 --- a/lib/backup/repository.rb +++ b/lib/backup/repository.rb @@ -81,6 +81,8 @@ module Backup FileUtils.mv(files, bk_repos_path) rescue Errno::EACCES access_denied_error(path) + rescue Errno::EBUSY + resource_busy_error(path) end end end |