summaryrefslogtreecommitdiff
path: root/lib/gitlab/bitbucket_import/key_adder.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/bitbucket_import/key_adder.rb')
-rw-r--r--lib/gitlab/bitbucket_import/key_adder.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/gitlab/bitbucket_import/key_adder.rb b/lib/gitlab/bitbucket_import/key_adder.rb
index 9931aa7e029..0b63f025d0a 100644
--- a/lib/gitlab/bitbucket_import/key_adder.rb
+++ b/lib/gitlab/bitbucket_import/key_adder.rb
@@ -3,14 +3,15 @@ module Gitlab
class KeyAdder
attr_reader :repo, :current_user, :client
- def initialize(repo, current_user)
+ def initialize(repo, current_user, access_params)
@repo, @current_user = repo, current_user
- @client = Client.new(current_user.bitbucket_access_token, current_user.bitbucket_access_token_secret)
+ @client = Client.new(access_params[:bitbucket_access_token],
+ access_params[:bitbucket_access_token_secret])
end
def execute
return false unless BitbucketImport.public_key.present?
-
+
project_identifier = "#{repo["owner"]}/#{repo["slug"]}"
client.add_deploy_key(project_identifier, BitbucketImport.public_key)