diff options
Diffstat (limited to 'lib/gitlab_keys.rb')
-rw-r--r-- | lib/gitlab_keys.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/gitlab_keys.rb b/lib/gitlab_keys.rb index 1ed0ab3..10f84bd 100644 --- a/lib/gitlab_keys.rb +++ b/lib/gitlab_keys.rb @@ -71,8 +71,12 @@ class GitlabKeys $stdin end + def key_command(key_id) + "#{ROOT_PATH}/bin/gitlab-shell #{key_id}" + end + def key_line(key_id, public_key) - auth_line = "command=\"#{ROOT_PATH}/bin/gitlab-shell #{key_id}\",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty #{public_key}" + auth_line = "command=\"#{key_command(key_id)}\",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty #{public_key}" end def rm_key @@ -81,7 +85,7 @@ class GitlabKeys Tempfile.open('authorized_keys') do |temp| open(auth_file, 'r+') do |current| current.each do |line| - temp.puts(line) unless line.include?("/bin/gitlab-shell #{@key_id}\"") + temp.puts(line) unless line.start_with?("command=\"#{key_command(@key_id)}\"") end end temp.close |