Commit 0ef0150d authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'destroy_duplicate_keys' of /home/git/repositories/gitlab/gitlabhq

parents f003ad59 1dda34f3
desc "GITLAB | Migrate SSH Keys" desc "GITLAB | Migrate SSH Keys"
task migrate_keys: :environment do task migrate_keys: :environment do
puts "This will add fingerprint to ssh keys in db" puts "This will add fingerprint to ssh keys in db"
puts "If you have duplicate keys https://github.com/gitlabhq/gitlabhq/issues/4453 all but the first will be deleted".yellow
ask_to_continue ask_to_continue
Key.find_each(batch_size: 20) do |key| Key.find_each(batch_size: 20) do |key|
if key.valid? && key.save if key.valid? && key.save
print '.' print '.'
elsif key.fingerprint.present?
puts "\nDeleting #{key.inspect}".yellow
key.destroy
else else
print 'F' print 'F'
end end
end end
print "\n"
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment