Commit 32e2e0c7 authored by Romain Bouvier's avatar Romain Bouvier
Browse files

Fix assignee during migration

- For an unknow reason, a token with "sudo" API access can't assign the
  issue (?!). It works with an API token without "sudo" grant, but then
you can't readd subscriber
- But if you assign the issue at creation time, it works !
parent 35a4f4ed
......@@ -176,18 +176,19 @@ def processbug(bgo, bzurl, instance, resolution, target, user_cache,
sudo = user_cache[bzbug.creator].id
else:
sudo = None
issue = target.create_issue(bzbug.id, bzbug.summary, description,
labels, milestone,
str(bzbug.creation_time))
#sudo=sudo)
# Assign bug to actual account if exists
print("bz issue assigned to {}".format(bzbug.assigned_to))
assignee = user_cache[bzbug.assigned_to]
print("Assign issue to {} if possible".format(assignee))
assignee_id = None
if assignee and assignee.id is not None:
print("Assign issue to {}".format(assignee))
issue.assignee_id = assignee.id
assignee_id = assignee.id
issue = target.create_issue(bzbug.id, bzbug.summary, description,
labels, milestone,
str(bzbug.creation_time),
assignee_id)
#sudo=sudo)
print("Migrating comments: ")
c = 0
......
......@@ -32,12 +32,13 @@ class GitLab:
return self.gl.projects.get(self.target_project)
def create_issue(self, id, summary, description, labels,
milestone, creation_time, sudo=None):
milestone, creation_time, assignee, sudo=None):
payload = {
'title': summary,
'description': description,
'labels': labels,
'created_at': creation_time
'created_at': creation_time,
'assignee_id': assignee
}
if milestone:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment