diff options
author | Douwe Maan <douwe@gitlab.com> | 2017-06-28 17:54:15 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2017-06-28 17:54:15 +0000 |
commit | 4539a066ecd2c5a16cab66f9e85f8f0ab747fc5f (patch) | |
tree | 299888d74240d7a714267c14f448dd2187af6392 /lib | |
parent | 7e41e378ab71b326f28d62195faeca5c54aafdb8 (diff) | |
parent | fb4260ce3340bde750f0426c1e539d06b0445fe2 (diff) | |
download | gitlab-shell-4539a066ecd2c5a16cab66f9e85f8f0ab747fc5f.tar.gz |
Merge branch 'add-list-key-ids' into 'master'v5.1.0
Add list-key-ids command
See merge request !140
Diffstat (limited to 'lib')
-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| |