diff options
author | Michael Kozono <mkozono@gmail.com> | 2018-12-19 21:10:00 +0000 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2018-12-19 21:10:00 +0000 |
commit | 9f80f0405968dff3ec65b59fcc291c0ee87cdf3a (patch) | |
tree | 135077c7311448ae5a21930967293d9c980f7908 /lib/tasks | |
parent | baad9fb8b90764e80ddda3a61873582ad7452aec (diff) | |
download | gitlab-ce-9f80f0405968dff3ec65b59fcc291c0ee87cdf3a.tar.gz |
Prevent admins from attempting hashed storage migration on read only DB
Diffstat (limited to 'lib/tasks')
-rw-r--r-- | lib/tasks/gitlab/storage.rake | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/tasks/gitlab/storage.rake b/lib/tasks/gitlab/storage.rake index f539b1df955..09dc3aa9882 100644 --- a/lib/tasks/gitlab/storage.rake +++ b/lib/tasks/gitlab/storage.rake @@ -2,6 +2,12 @@ namespace :gitlab do namespace :storage do desc 'GitLab | Storage | Migrate existing projects to Hashed Storage' task migrate_to_hashed: :environment do + if Gitlab::Database.read_only? + warn 'This task requires database write access. Exiting.' + + next + end + storage_migrator = Gitlab::HashedStorage::Migrator.new helper = Gitlab::HashedStorage::RakeHelper @@ -9,7 +15,7 @@ namespace :gitlab do project = Project.with_unmigrated_storage.find_by(id: helper.range_from) unless project - puts "There are no projects requiring storage migration with ID=#{helper.range_from}" + warn "There are no projects requiring storage migration with ID=#{helper.range_from}" next end @@ -23,7 +29,7 @@ namespace :gitlab do legacy_projects_count = Project.with_unmigrated_storage.count if legacy_projects_count == 0 - puts 'There are no projects requiring storage migration. Nothing to do!' + warn 'There are no projects requiring storage migration. Nothing to do!' next end |