Commit 0ef0150d8c5ff6fec88c64056ee8c788aed0aa14
Exists in
master
and in
4 other branches
Merge branch 'destroy_duplicate_keys' of /home/git/repositories/gitlab/gitlabhq
Showing
1 changed file
with
5 additions
and
0 deletions
Show diff stats
lib/tasks/migrate/migrate_keys.rake
1 | 1 | desc "GITLAB | Migrate SSH Keys" |
2 | 2 | task migrate_keys: :environment do |
3 | 3 | 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 | |
4 | 5 | ask_to_continue |
5 | 6 | |
6 | 7 | Key.find_each(batch_size: 20) do |key| |
7 | 8 | if key.valid? && key.save |
8 | 9 | print '.' |
10 | + elsif key.fingerprint.present? | |
11 | + puts "\nDeleting #{key.inspect}".yellow | |
12 | + key.destroy | |
9 | 13 | else |
10 | 14 | print 'F' |
11 | 15 | end |
12 | 16 | end |
17 | + print "\n" | |
13 | 18 | end |
14 | 19 | |
15 | 20 | ... | ... |