summaryrefslogtreecommitdiff
path: root/lib/gitlab/bitbucket_import/key_deleter.rb
blob: e03c3155b3ebeebf18e9e80fe62d135596fc2e88 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
module Gitlab
  module BitbucketImport
    class KeyDeleter
      attr_reader :project, :current_user, :client

      def initialize(project)
        @project = project
        @current_user = project.creator
        @client = Client.from_project(@project)
      end

      def execute
        return false unless BitbucketImport.public_key.present?

        client.delete_deploy_key(project.import_source, BitbucketImport.public_key)

        true
      rescue
        false
      end
    end
  end
end