summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2018-08-08 11:39:04 +0200
committerÆvar Arnfjörð Bjarmason <avarab@gmail.com>2018-08-08 21:07:50 +0200
commitc4b5a076040a6f6156c26f66cdc47610fc267db2 (patch)
tree8bd3bf0e70bc4e0301f066c1c6d166b8957e4fa4 /lib
parentc6577e0d75f51b017f2f332838b97c3ca5b497c0 (diff)
downloadgitlab-shell-c4b5a076040a6f6156c26f66cdc47610fc267db2.tar.gz
Fix two regressions in SSH certificate support
Fix two regressions in my 2e8b670 ("Add support for SSH certificate authentication", 2018-06-14) merged in gitlab-org/gitlab-shell!207. This fixes the issue noted in gitlab-org/gitlab-shell#145 where the command-line contains things other than the key/user/username, and also a regression where SSH certificates are being used, and the username presented in the key is unknown to GitLab. In that case, we should log the user in as "Anonymous" (on an instance that allows public access), but because of how the error checking around api.discover() was implemented we ended up erroring out instead.
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab_shell.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/gitlab_shell.rb b/lib/gitlab_shell.rb
index 78fdfe8..c6b28ce 100644
--- a/lib/gitlab_shell.rb
+++ b/lib/gitlab_shell.rb
@@ -208,7 +208,7 @@ class GitlabShell # rubocop:disable Metrics/ClassLength
begin
if defined?(@who)
@user = api.discover(@who)
- @gl_id = "user-#{@user['id']}"
+ @gl_id = "user-#{@user['id']}" if @user
else
@user = api.discover(@gl_id)
end