diff options
author | Michael Kozono <mkozono@gmail.com> | 2017-06-27 16:47:05 -0700 |
---|---|---|
committer | Michael Kozono <mkozono@gmail.com> | 2017-06-28 07:32:48 -0700 |
commit | f980d8f59b172122d4985923094ea3b8342d6da2 (patch) | |
tree | 4a3457c9895f0e58849dd48e87655d5a595301a6 /lib/gitlab_keys.rb | |
parent | 7e41e378ab71b326f28d62195faeca5c54aafdb8 (diff) | |
download | gitlab-shell-f980d8f59b172122d4985923094ea3b8342d6da2.tar.gz |
Add list-key-ids command
Diffstat (limited to 'lib/gitlab_keys.rb')
-rw-r--r-- | lib/gitlab_keys.rb | 13 |
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| |