Commit 6ec6fa78 authored by Akzhan's avatar Akzhan

Do not fall on discover deployment keys. Closes #25

parent f0eb8017
...@@ -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