2015-02-18 11:00:26 -05:00
|
|
|
module Gitlab
|
|
|
|
module BitbucketImport
|
2016-03-28 10:35:03 -04:00
|
|
|
class KeyDeleter
|
|
|
|
attr_reader :project, :current_user, :client
|
|
|
|
|
|
|
|
def initialize(project)
|
|
|
|
@project = project
|
|
|
|
@current_user = project.creator
|
|
|
|
@client = Client.from_project(@project)
|
|
|
|
end
|
2015-02-18 11:00:26 -05:00
|
|
|
|
|
|
|
def execute
|
|
|
|
return false unless BitbucketImport.public_key.present?
|
2015-08-07 03:06:20 -04:00
|
|
|
|
2015-02-18 11:00:26 -05:00
|
|
|
client.delete_deploy_key(project.import_source, BitbucketImport.public_key)
|
|
|
|
|
|
|
|
true
|
|
|
|
rescue
|
|
|
|
false
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|