@@ -34,7 +34,7 @@ import os
3434import re
3535import time
3636from redminelib import Redmine # https://pypi.org/project/python-redmine/
37- from redminelib .exceptions import ResourceAttrError
37+ from redminelib .exceptions import ResourceAttrError , ValidationError
3838
3939redmine_endpoint = "https://tracker.ceph.com"
4040project_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