Commit e621b365 authored by Ash McKenzie's avatar Ash McKenzie

Use full_key to highlight it's the full SSH key

parent be5b38f5
......@@ -10,16 +10,16 @@
# command="/bin/gitlab-shell key-#",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty ssh-rsa AAAAB3NzaC1yc2EAAAADAQA...
#
key = ARGV[0]
abort "# No key provided" if key.nil? || key.empty?
full_key = ARGV[0]
abort "# No key provided" if full_key.nil? || full_key.empty?
require_relative "../lib/gitlab_init"
require_relative "../lib/gitlab_net"
require_relative "../lib/gitlab_keys"
authorized_key = GitlabNet.new.authorized_key(key)
authorized_key = GitlabNet.new.authorized_key(full_key)
if authorized_key.nil?
puts "# No key was found for #{key}"
puts "# No key was found for #{full_key}"
else
puts GitlabKeys.key_line("key-#{authorized_key['id']}", authorized_key["key"])
puts GitlabKeys.key_line("key-#{authorized_key['id']}", authorized_key['key'])
end
......@@ -13,7 +13,7 @@ require_relative '../lib/gitlab_init'
# /bin/gitlab-keys rm-key key-23 "ssh-rsa AAAAx321..."
#
# /bin/gitlab-keys list-keys
#
#
# /bin/gitlab-keys clear
#
......
......@@ -27,16 +27,16 @@ abort '# No username provided' if actual_username.nil? || actual_username == ''
# Normally, these would both be 'git', but it can be configured by the user
exit 0 unless expected_username == actual_username
key = ARGV[2]
abort "# No key provided" if key.nil? || key == ''
full_key = ARGV[2]
abort "# No key provided" if full_key.nil? || full_key == ''
require_relative '../lib/gitlab_init'
require_relative '../lib/gitlab_net'
require_relative '../lib/gitlab_keys'
authorized_key = GitlabNet.new.authorized_key(key)
authorized_key = GitlabNet.new.authorized_key(full_key)
if authorized_key.nil?
puts "# No key was found for #{key}"
puts "# No key was found for #{full_key}"
else
puts GitlabKeys.key_line("key-#{authorized_key['id']}", authorized_key['key'])
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment