summaryrefslogtreecommitdiff
path: root/lib/gitlab_net.rb
diff options
context:
space:
mode:
authorPablo Carranza <pcarranza@gmail.com>2016-03-08 17:49:22 +0000
committerPablo Carranza <pcarranza@gmail.com>2016-03-24 20:48:27 +0000
commitc9fac154cd99233c9a6f1cbb88316a476fffc3ad (patch)
tree6d7c6ea65e4c0204ca9596adc3da7e9e29caa51c /lib/gitlab_net.rb
parent1f2bef765d8aa03b76f991178cfa7513833b4c3b (diff)
downloadgitlab-shell-c9fac154cd99233c9a6f1cbb88316a476fffc3ad.tar.gz
Add authorized keys bin script to find keys by fingerprint
Diffstat (limited to 'lib/gitlab_net.rb')
-rw-r--r--lib/gitlab_net.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/gitlab_net.rb b/lib/gitlab_net.rb
index ddf2a06..503a267 100644
--- a/lib/gitlab_net.rb
+++ b/lib/gitlab_net.rb
@@ -56,9 +56,11 @@ class GitlabNet
get("#{host}/check", read_timeout: CHECK_TIMEOUT)
end
- def ssh_key(fingerprint)
+ def authorized_key(fingerprint)
resp = get("#{host}/ssh-key?fingerprint=#{fingerprint}")
- JSON.parse(resp.body) rescue nil
+ JSON.parse(resp.body) if resp.code == "200"
+ rescue
+ nil
end
protected