]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
script/backport-create-issue: handle ResourceAttrError when getting CF_TAGS 58883/head
authorIlya Dryomov <idryomov@gmail.com>
Sat, 27 Jul 2024 16:41:14 +0000 (18:41 +0200)
committerIlya Dryomov <idryomov@gmail.com>
Sat, 27 Jul 2024 17:09:50 +0000 (19:09 +0200)
Older versions of python-redmine may raise ResourceAttrError here
instead of returning None, see [1].  Being prepared for an exception
seems like a good idea regardless given how this field recently got
recreated.

[1] https://github.com/maxtepkeev/python-redmine/commit/0de5689ef5891c1be263c0b3deb8b03966a9c5bd

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
src/script/backport-create-issue

index 4621411a101b0e49fc22c66590bd02ab3fefc6fe..10ed843e2b361c91e575fb743a9616242188e0c6 100755 (executable)
@@ -319,11 +319,13 @@ def mark_as_processed(r, issue):
     logging.debug("custom_fields: %s", list(issue['custom_fields']))
 
     tags_cf = next(filter(lambda x: x['id'] == CF_TAGS, issue['custom_fields']), None)
-
     if tags_cf is None:
         tags = ''
     else:
-        tags = tags_cf.value
+        try:
+            tags = tags_cf.value
+        except ResourceAttrError:
+            tags = None
         if tags is None:
             tags = ''
         else: