]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
script/backport-create-issue: handle long Redmine issue names 27887/head
authorNathan Cutler <ncutler@suse.com>
Tue, 30 Apr 2019 11:38:33 +0000 (13:38 +0200)
committerNathan Cutler <ncutler@suse.com>
Tue, 30 Apr 2019 11:38:33 +0000 (13:38 +0200)
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>
src/script/backport-create-issue

index b77c7cfaaf26c113e402682b994e7f7efdac85bc..01587ceea3aec99a56ad881bd9fb655d10291a01 100755 (executable)
@@ -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