Commit 02c7da2e authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge pull request #26 from regru/do_not_fall_on_deploy_keys

Do not fall on discover deployment keys. Closes #25
parents 30185044 6ec6fa78
...@@ -22,7 +22,7 @@ class GitlabNet ...@@ -22,7 +22,7 @@ class GitlabNet
def discover(key) def discover(key)
key_id = key.gsub("key-", "") key_id = key.gsub("key-", "")
resp = get("#{host}/discover?key_id=#{key_id}") resp = get("#{host}/discover?key_id=#{key_id}")
JSON.parse(resp.body) JSON.parse(resp.body) rescue nil
end end
def check def check
......
...@@ -26,7 +26,7 @@ class GitlabShell ...@@ -26,7 +26,7 @@ class GitlabShell
end end
else else
user = api.discover(@key_id) user = api.discover(@key_id)
puts "Welcome to GitLab, #{user['name']}!" puts "Welcome to GitLab, #{user && user['name'] || 'Anonymous'}!"
end end
end 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