Skip to content

Commit 7626d95

Browse files
committed
Logging throughout gitlab-shell.
1 parent 51727f5 commit 7626d95

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

lib/gitlab_shell.rb

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,15 @@ def exec
2020

2121
if validate_access
2222
process_cmd
23+
else
24+
message = "gitlab-shell: Access denied for git command <#{@origin_cmd}>"
25+
message << " by user with key #{@key_id}."
26+
$logger.warn message
2327
end
2428
else
29+
message = "gitlab-shell: Attempt to execute disallowed command "
30+
message << "<#{@origin_cmd}> by user with key #{@key_id}."
31+
$logger.warn message
2532
puts 'Not allowed command'
2633
end
2734
else
@@ -44,7 +51,9 @@ def git_cmds
4451

4552
def process_cmd
4653
repo_full_path = File.join(repos_path, repo_name)
47-
exec_cmd "#{@git_cmd} #{repo_full_path}"
54+
cmd = "#{@git_cmd} #{repo_full_path}"
55+
$logger.info "gitlab-shell: executing git command <#{cmd}> for user with key #{@key_id}."
56+
exec_cmd(cmd)
4857
end
4958

5059
def validate_access

0 commit comments

Comments
 (0)