Skip to content

Commit fbc062c

Browse files
committed
Merge PR ceph#58768 into main
* refs/pull/58768/head: script/backport-create-issue: retry without if assignee is invalid Reviewed-by: Ernesto Puerta <[email protected]> Reviewed-by: Ilya Dryomov <[email protected]>
2 parents a477c1c + 2e8c0c2 commit fbc062c

File tree

1 file changed

+21
-11
lines changed

1 file changed

+21
-11
lines changed

src/script/backport-create-issue

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import os
3434
import re
3535
import time
3636
from redminelib import Redmine # https://pypi.org/project/python-redmine/
37-
from redminelib.exceptions import ResourceAttrError
37+
from redminelib.exceptions import ResourceAttrError, ValidationError
3838

3939
redmine_endpoint = "https://tracker.ceph.com"
4040
project_name = "Ceph"
@@ -239,16 +239,26 @@ def update_relations(r, issue, dry_run):
239239
if dry_run:
240240
logging.info(url(issue) + " add backport to " + release)
241241
continue
242-
other = r.issue.create(project_id=issue['project']['id'],
243-
tracker_id=backport_tracker_id,
244-
subject=subject,
245-
priority_id=issue['priority']['id'],
246-
assigned_to_id=assigned_to_id,
247-
target_version=None,
248-
custom_fields=[{
249-
"id": release_id,
250-
"value": release,
251-
}])
242+
create_args = {
243+
"project_id": issue['project']['id'],
244+
"tracker_id": backport_tracker_id,
245+
"subject": subject,
246+
"priority_id": issue['priority']['id'],
247+
"assigned_to_id": assigned_to_id,
248+
"target_version": None,
249+
"custom_fields": [
250+
{
251+
"id": release_id,
252+
"value": release,
253+
}
254+
]
255+
}
256+
try:
257+
other = r.issue.create(**create_args)
258+
except ValidationError as e:
259+
# try without an assignee
260+
del create_args['assigned_to_id']
261+
other = r.issue.create(**create_args)
252262
logging.debug("Rate-limiting to avoid seeming like a spammer")
253263
time.sleep(delay_seconds)
254264
r.issue_relation.create(issue_id=issue['id'],

0 commit comments

Comments
 (0)