summaryrefslogtreecommitdiff
path: root/lib/gitlab_net.rb
diff options
context:
space:
mode:
authorAsh McKenzie <amckenzie@gitlab.com>2018-11-07 10:07:52 +1100
committerAsh McKenzie <amckenzie@gitlab.com>2018-11-08 09:52:10 +1100
commit1c6a8d1d70c1603c73fb9bcb8f440dbf97988e89 (patch)
treea83d262d697d3d5265716ddd8bf7650870063eca /lib/gitlab_net.rb
parent9cf3334cb5cdf871266a2b9538589e36efd788e1 (diff)
downloadgitlab-shell-1c6a8d1d70c1603c73fb9bcb8f440dbf97988e89.tar.gz
Include LFS operation when making auth requestashmckenzie/8114-geo-push-ssh-lfs-http-auth-bug
Operation is either upload or download
Diffstat (limited to 'lib/gitlab_net.rb')
-rw-r--r--lib/gitlab_net.rb22
1 files changed, 8 insertions, 14 deletions
diff --git a/lib/gitlab_net.rb b/lib/gitlab_net.rb
index ac98e9f..bba68f3 100644
--- a/lib/gitlab_net.rb
+++ b/lib/gitlab_net.rb
@@ -53,28 +53,22 @@ class GitlabNet # rubocop:disable Metrics/ClassLength
JSON.parse(resp.body) rescue nil
end
- def lfs_authenticate(gl_id, repo)
+ def lfs_authenticate(gl_id, repo, operation)
id_sym, _, id = self.class.parse_who(gl_id)
+ params = { project: sanitize_path(repo), operation: operation }
- if id_sym == :key_id
- params = {
- project: sanitize_path(repo),
- key_id: id
- }
- elsif id_sym == :user_id
- params = {
- project: sanitize_path(repo),
- user_id: id
- }
+ case id_sym
+ when :key_id
+ params[:key_id] = id
+ when :user_id
+ params[:user_id] = id
else
raise ArgumentError, "lfs_authenticate() got unsupported GL_ID='#{gl_id}'!"
end
resp = post("#{internal_api_endpoint}/lfs_authenticate", params)
- if resp.code == '200'
- GitlabLfsAuthentication.build_from_json(resp.body)
- end
+ GitlabLfsAuthentication.build_from_json(resp.body) if resp.code == '200'
end
def broadcast_message