migrate_keys.rake 510 Bytes
Newer Older
1 2 3
desc "GITLAB | Migrate SSH Keys"
task migrate_keys: :environment do
  puts "This will add fingerprint to ssh keys in db"
4
  puts "If you have duplicate keys https://github.com/gitlabhq/gitlabhq/issues/4453 all but the first will be deleted".yellow
5 6 7 8 9
  ask_to_continue

  Key.find_each(batch_size: 20) do |key|
    if key.valid? && key.save
      print '.'
10 11 12
    elsif key.fingerprint.present?
      puts "\nDeleting #{key.inspect}".yellow
      key.destroy
13 14 15 16
    else
      print 'F'
    end
  end
17
  print "\n"
18 19 20
end