script/backport-create-issue: handle long Redmine issue names

Redmine issue names have a maximum length of 255 characters. When we prepend,
e.g., "nautilus: " to a very long issue name, we can end up with a string that
is over 255 characters long. Such a string will be refused by Redmine:

ValidationError: Subject is too long (maximum is 255 characters)

This patch avoids such an eventuality by truncating the post-prepend string to
255 characters.

Signed-off-by: Nathan Cutler <ncutler@suse.com>
This commit is contained in:
Nathan Cutler 2019-04-30 13:38:33 +02:00
parent f82013123f
commit 2ddb581a63

View File

@ -189,7 +189,7 @@ def update_relations(r, issue, dry_run):
logging.error(url(issue) + " requires backport to " +
"unknown release " + release)
break
subject = release + ": " + issue['subject']
subject = (release + ": " + issue['subject'])[:255]
if dry_run:
logging.info(url(issue) + " add backport to " + release)
continue