diff options
author | Jacob Vosmaer <contact@jacobvosmaer.nl> | 2013-10-31 17:18:41 +0100 |
---|---|---|
committer | Jacob Vosmaer <contact@jacobvosmaer.nl> | 2013-10-31 18:13:03 +0100 |
commit | 8d6807098ffbe9492dbf1de2a7d9620bdeb348e3 (patch) | |
tree | 4eb26616042f328a1a4f3faeb5efabf713a25a0f /lib/gitlab_keys.rb | |
parent | d3c3fbc6163ca13b16351214349bd5a7f5b729a3 (diff) | |
download | gitlab-shell-8d6807098ffbe9492dbf1de2a7d9620bdeb348e3.tar.gz |
Use Kernel#open to append lines to authorized_keys
Diffstat (limited to 'lib/gitlab_keys.rb')
-rw-r--r-- | lib/gitlab_keys.rb | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/gitlab_keys.rb b/lib/gitlab_keys.rb index dc54740..2ea5117 100644 --- a/lib/gitlab_keys.rb +++ b/lib/gitlab_keys.rb @@ -29,9 +29,8 @@ class GitlabKeys def add_key $logger.info "Adding key #{@key_id} => #{@key.inspect}" - cmd = "command=\"#{ROOT_PATH}/bin/gitlab-shell #{@key_id}\",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty #{@key}" - cmd = "echo \'#{cmd}\' >> #{auth_file}" - system(cmd) + auth_line = "command=\"#{ROOT_PATH}/bin/gitlab-shell #{@key_id}\",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty #{@key}" + open(auth_file, 'a') { |file| file.puts(auth_line) } end def rm_key |