diff options
Diffstat (limited to 'lib/gitlab_keys.rb')
-rw-r--r-- | lib/gitlab_keys.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/gitlab_keys.rb b/lib/gitlab_keys.rb index 7e6362a..03026ed 100644 --- a/lib/gitlab_keys.rb +++ b/lib/gitlab_keys.rb @@ -1,6 +1,7 @@ require 'open3' require_relative 'gitlab_config' +require_relative 'gitlab_logger' class GitlabKeys attr_accessor :auth_file, :key @@ -17,6 +18,7 @@ class GitlabKeys when 'add-key'; add_key when 'rm-key'; rm_key else + $logger.warn "Attempt to execute invalid gitlab-keys command #{@command.inspect}." puts 'not allowed' false end @@ -25,12 +27,14 @@ class GitlabKeys protected 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) end def rm_key + $logger.info "Removing key #{@key_id}" cmd = "sed -i '/shell #{@key_id}\"/d' #{auth_file}" system(cmd) end |