fix gitlab import and spec
This commit is contained in:
parent
8aafe68583
commit
c136edbbe3
2 changed files with 7 additions and 5 deletions
|
@ -5,10 +5,13 @@ module Gitlab
|
|||
|
||||
def initialize(project)
|
||||
@project = project
|
||||
import_data = project.import_data.try(:data)
|
||||
gitlab_session = import_data["gitlab_session"] if import_data
|
||||
@client = Client.new(gitlab_session["gitlab_access_token"])
|
||||
@formatter = Gitlab::ImportFormatter.new
|
||||
credentials = import_data.credentials
|
||||
if credentials && credentials["password"]
|
||||
@client = Client.new(credentials["password"])
|
||||
@formatter = Gitlab::ImportFormatter.new
|
||||
else
|
||||
raise Projects::ImportService::Error, "Unable to find project import data credentials for project ID: #{@project.id}"
|
||||
end
|
||||
end
|
||||
|
||||
def execute
|
||||
|
|
|
@ -23,7 +23,6 @@ module Gitlab
|
|||
import_url: repo["http_url_to_repo"].sub("://", "://oauth2:#{@session_data[:gitlab_access_token]}@")
|
||||
).execute
|
||||
|
||||
project.create_import_data(data: { "gitlab_session" => session_data } )
|
||||
project
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue