diff options
author | Ahmad Sherif <me@ahmadsherif.com> | 2016-12-27 13:19:52 +0200 |
---|---|---|
committer | Ahmad Sherif <me@ahmadsherif.com> | 2016-12-27 13:27:34 +0200 |
commit | 7d7bde94745b793ae76049d8c8ad54314a762d29 (patch) | |
tree | 1a0293fd4334803d0157f8fa9f20022280726fed /lib/gitlab_shell.rb | |
parent | a3712cc18de8283b25c3a8a034ecc8c9b7feca48 (diff) | |
download | gitlab-shell-feature/gitaly-feature-flag.tar.gz |
Process commands with Gitaly if a flag is passed from the appfeature/gitaly-feature-flag
Diffstat (limited to 'lib/gitlab_shell.rb')
-rw-r--r-- | lib/gitlab_shell.rb | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/gitlab_shell.rb b/lib/gitlab_shell.rb index e243aac..2b728ad 100644 --- a/lib/gitlab_shell.rb +++ b/lib/gitlab_shell.rb @@ -13,7 +13,7 @@ class GitlabShell API_COMMANDS = %w(2fa_recovery_codes) GL_PROTOCOL = 'ssh'.freeze - attr_accessor :key_id, :repo_name, :command, :git_access + attr_accessor :key_id, :repo_name, :command, :git_access, :gitaly_address attr_reader :repo_path def initialize(key_id) @@ -98,6 +98,7 @@ class GitlabShell raise AccessDeniedError, status.message unless status.allowed? self.repo_path = status.repository_path + self.gitaly_address = status.gitaly_address end def process_cmd(args) @@ -126,9 +127,14 @@ class GitlabShell $logger.info "gitlab-shell: Processing LFS authentication for #{log_username}." lfs_authenticate end - else + end + + if gitaly_address.nil? $logger.info "gitlab-shell: executing git command <#{@command} #{repo_path}> for #{log_username}." exec_cmd(@command, repo_path) + else + $logger.info "gitlab-shell: processing with gitaly <#{gitaly_address}> command: <#{@command}> repo: <#{repo_path}> for <#{log_username}>." + process_cmd_with_gitaly(@command, repo_path) end end @@ -165,6 +171,10 @@ class GitlabShell Kernel::exec(env, *args, unsetenv_others: true) end + def process_cmd_with_gitaly(cmd, repo_path) + # To be implemented + end + def api GitlabNet.new end |