diff options
| author | Robert Speicher <robert@gitlab.com> | 2017-07-07 17:00:03 +0000 |
|---|---|---|
| committer | Robert Speicher <robert@gitlab.com> | 2017-07-07 17:00:03 +0000 |
| commit | e7ec27f5adb3bbc29520ef16272f7332b7eceb34 (patch) | |
| tree | b293793d65e1f1abbf4b5bc46d8d5c9484af1db4 /lib | |
| parent | 0a0cfdf965a253d4010afeb4ee9d83528ea16359 (diff) | |
| parent | 933b56691d4b95b642c19d91cbeccb098d3a1696 (diff) | |
| download | gitlab-shell-e7ec27f5adb3bbc29520ef16272f7332b7eceb34.tar.gz | |
Merge branch 'gitaly-124-gitaly-ssh' into 'master'
Gitaly SSH Client
See merge request !139
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/gitlab_access_status.rb | 7 | ||||
| -rw-r--r-- | lib/gitlab_shell.rb | 11 |
2 files changed, 12 insertions, 6 deletions
diff --git a/lib/gitlab_access_status.rb b/lib/gitlab_access_status.rb index 6a906f1..a6a274c 100644 --- a/lib/gitlab_access_status.rb +++ b/lib/gitlab_access_status.rb @@ -1,18 +1,19 @@ require 'json' class GitAccessStatus - attr_reader :message, :gl_repository, :repository_path + attr_reader :message, :gl_repository, :repository_path, :gitaly - def initialize(status, message, gl_repository, repository_path) + def initialize(status, message, gl_repository, repository_path, gitaly) @status = status @message = message @gl_repository = gl_repository @repository_path = repository_path + @gitaly = gitaly end def self.create_from_json(json) values = JSON.parse(json) - self.new(values["status"], values["message"], values["gl_repository"], values["repository_path"]) + self.new(values["status"], values["message"], values["gl_repository"], values["repository_path"], values["gitaly"]) end def allowed? diff --git a/lib/gitlab_shell.rb b/lib/gitlab_shell.rb index e7d0254..262f9f7 100644 --- a/lib/gitlab_shell.rb +++ b/lib/gitlab_shell.rb @@ -99,6 +99,7 @@ class GitlabShell self.repo_path = status.repository_path @gl_repository = status.gl_repository + @gitaly = status.gitaly end def process_cmd(args) @@ -115,15 +116,16 @@ class GitlabShell executable = @command args = [repo_path] - if GITALY_MIGRATED_COMMANDS.has_key?(executable) + if GITALY_MIGRATED_COMMANDS.has_key?(executable) && @gitaly executable = GITALY_MIGRATED_COMMANDS[executable] - gitaly_address = '' # would be returned by gitlab-rails internal API + gitaly_address = @gitaly['address'] # The entire gitaly_request hash should be built in gitlab-ce and passed # on as-is. For now we build a fake one on the spot. gitaly_request = JSON.dump({ - 'repository' => { 'path' => repo_path }, + 'repository' => @gitaly['repository'], + 'gl_repository' => @gl_repository, 'gl_id' => @key_id, }) @@ -153,6 +155,9 @@ class GitlabShell 'GL_PROTOCOL' => GL_PROTOCOL, 'GL_REPOSITORY' => @gl_repository } + if @gitaly && @gitaly.include?('token') + env['GITALY_TOKEN'] = @gitaly['token'] + end if git_trace_available? env.merge!({ |
