summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorash <smashwilson@gmail.com>2013-05-18 19:07:14 +0000
committerash <smashwilson@gmail.com>2013-05-18 19:07:14 +0000
commit7626d9575e5f95fcf127a0fc5fcaa4fde2585547 (patch)
tree6704028ce1767f114e9d208e1cee3f8bbec5817c
parent51727f5cd51d20d5c9fb1cfafe380da828d5f52f (diff)
downloadgitlab-shell-7626d9575e5f95fcf127a0fc5fcaa4fde2585547.tar.gz
Logging throughout gitlab-shell.
-rw-r--r--lib/gitlab_shell.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/gitlab_shell.rb b/lib/gitlab_shell.rb
index 2d49370..496f3a1 100644
--- a/lib/gitlab_shell.rb
+++ b/lib/gitlab_shell.rb
@@ -20,8 +20,15 @@ class GitlabShell
if validate_access
process_cmd
+ else
+ message = "gitlab-shell: Access denied for git command <#{@origin_cmd}>"
+ message << " by user with key #{@key_id}."
+ $logger.warn message
end
else
+ message = "gitlab-shell: Attempt to execute disallowed command "
+ message << "<#{@origin_cmd}> by user with key #{@key_id}."
+ $logger.warn message
puts 'Not allowed command'
end
else
@@ -44,7 +51,9 @@ class GitlabShell
def process_cmd
repo_full_path = File.join(repos_path, repo_name)
- exec_cmd "#{@git_cmd} #{repo_full_path}"
+ cmd = "#{@git_cmd} #{repo_full_path}"
+ $logger.info "gitlab-shell: executing git command <#{cmd}> for user with key #{@key_id}."
+ exec_cmd(cmd)
end
def validate_access