summaryrefslogtreecommitdiff
path: root/lib/tasks
diff options
context:
space:
mode:
authorPatrick Bajao <ebajao@gitlab.com>2019-03-19 11:16:21 +0000
committerNick Thomas <nick@gitlab.com>2019-03-19 11:16:21 +0000
commit26dadbc9c4ed94d1bc3c9eabf958edf6597e12e4 (patch)
treea31f376d932c3d9704ccd1c6c06a6108a3b5b11e /lib/tasks
parent7fb9dff43dcf56472e22be7a26805ee5fa339e8b (diff)
downloadgitlab-ce-26dadbc9c4ed94d1bc3c9eabf958edf6597e12e4.tar.gz
Integrate Gitlab::Keys with Gitlab::Shell
In this commit, some methods that aren't being used are removed from `Gitlab::Shell`. They are the ff: - `#remove_keys_not_found_in_db` - `#batch_read_key_ids` - `#list_key_ids` The corresponding methods in `Gitlab::Keys` have been removed as well.
Diffstat (limited to 'lib/tasks')
-rw-r--r--lib/tasks/gitlab/shell.rake15
1 files changed, 4 insertions, 11 deletions
diff --git a/lib/tasks/gitlab/shell.rake b/lib/tasks/gitlab/shell.rake
index 0ebc6f00793..ee3ef9dad6e 100644
--- a/lib/tasks/gitlab/shell.rake
+++ b/lib/tasks/gitlab/shell.rake
@@ -103,19 +103,12 @@ namespace :gitlab do
Gitlab::Shell.new.remove_all_keys
- Gitlab::Shell.new.batch_add_keys do |adder|
- Key.find_each(batch_size: 1000) do |key|
- adder.add_key(key.shell_id, key.key)
- print '.'
+ Key.find_in_batches(batch_size: 1000) do |keys|
+ unless Gitlab::Shell.new.batch_add_keys(keys)
+ puts "Failed to add keys...".color(:red)
+ exit 1
end
end
- puts ""
-
- unless $?.success?
- puts "Failed to add keys...".color(:red)
- exit 1
- end
-
rescue Gitlab::TaskAbortedByUserError
puts "Quitting...".color(:red)
exit 1