summaryrefslogtreecommitdiff
path: root/lib/gitlab_keys.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab_keys.rb')
-rw-r--r--lib/gitlab_keys.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/gitlab_keys.rb b/lib/gitlab_keys.rb
index 46189ae..975ee3e 100644
--- a/lib/gitlab_keys.rb
+++ b/lib/gitlab_keys.rb
@@ -39,6 +39,8 @@ class GitlabKeys
rm_key
when 'list-keys';
list_keys
+ when 'list-key-ids';
+ list_key_ids
when 'clear';
clear
when 'check-permissions';
@@ -75,6 +77,17 @@ class GitlabKeys
keys
end
+ def list_key_ids
+ $logger.info 'Listing all key IDs'
+ open_auth_file('r') do |f|
+ f.each_line do |line|
+ matchd = line.match(/key-(\d+)/)
+ next unless matchd
+ puts matchd[1]
+ end
+ end
+ end
+
def batch_add_keys
lock(300) do # Allow 300 seconds (5 minutes) for batch_add_keys
open_auth_file('a') do |file|