summaryrefslogtreecommitdiff
path: root/lib/gitlab_keys.rb
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-02-05 11:02:32 +0200
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-02-05 11:02:32 +0200
commit2241d7674568423d6f57fb565b3ff53167bd5ca8 (patch)
tree51c2cad1ed92eaf80ca3f18dcaa14d4c5c076473 /lib/gitlab_keys.rb
parenta8b9cb85fc1ea861dc31bdbaaeb8c76b1b5cbfd7 (diff)
downloadgitlab-shell-2241d7674568423d6f57fb565b3ff53167bd5ca8.tar.gz
add/remove keys by id
Diffstat (limited to 'lib/gitlab_keys.rb')
-rw-r--r--lib/gitlab_keys.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/gitlab_keys.rb b/lib/gitlab_keys.rb
index 1cbaffb..d223d81 100644
--- a/lib/gitlab_keys.rb
+++ b/lib/gitlab_keys.rb
@@ -2,11 +2,11 @@ require 'open3'
require_relative 'gitlab_config'
class GitlabKeys
- attr_accessor :auth_file, :key, :username
+ attr_accessor :auth_file, :key
def initialize
@command = ARGV.shift
- @username = ARGV.shift
+ @key_id = ARGV.shift
@key = ARGV.shift
@auth_file = GitlabConfig.new.auth_file
end
@@ -23,13 +23,13 @@ class GitlabKeys
protected
def add_key
- cmd = "command=\"#{ROOT_PATH}/bin/gitlab-shell #{@username}\",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty #{@key}"
+ 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)
end
def rm_key
- cmd = "sed '/#{@key}/d' #{auth_file}"
+ cmd = "sed '/#{@key_id}/d' #{auth_file}"
system(cmd)
end
end