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