summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2015-02-17 22:52:32 +0100
committerDouwe Maan <douwe@gitlab.com>2015-02-24 15:07:24 +0100
commit448817c4de965bf7286f33a3447937987a8864a1 (patch)
tree4429ddccab6ff9437950f449272dfdad7362d0b1 /lib
parentad6d6232342558705c54ba70a94f9d7ddbd00f8c (diff)
downloadgitlab-ce-448817c4de965bf7286f33a3447937987a8864a1.tar.gz
Load public key in initializer.
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/bitbucket_import.rb6
-rw-r--r--lib/gitlab/bitbucket_import/key_adder.rb9
2 files changed, 12 insertions, 3 deletions
diff --git a/lib/gitlab/bitbucket_import.rb b/lib/gitlab/bitbucket_import.rb
new file mode 100644
index 00000000000..0e53972ac50
--- /dev/null
+++ b/lib/gitlab/bitbucket_import.rb
@@ -0,0 +1,6 @@
+module Gitlab
+ module BitbucketImport
+ mattr_accessor :public_key
+ @public_key = nil
+ end
+end \ No newline at end of file
diff --git a/lib/gitlab/bitbucket_import/key_adder.rb b/lib/gitlab/bitbucket_import/key_adder.rb
index 207811237ba..7d0b5fbc8ae 100644
--- a/lib/gitlab/bitbucket_import/key_adder.rb
+++ b/lib/gitlab/bitbucket_import/key_adder.rb
@@ -9,13 +9,16 @@ module Gitlab
end
def execute
+ return false unless BitbucketImport.public_key.present?
+
project_identifier = "#{repo["owner"]}/#{repo["slug"]}"
return true if client.deploy_key(project_identifier)
-
- # TODO: Point to actual public key.
- client.add_deploy_key(project_identifier, File.read("/Users/douwemaan/.ssh/id_rsa.pub"))
+
+ client.add_deploy_key(project_identifier, BitbucketImport.public_key)
true
+ rescue
+ false
end
end
end