From: Ilya Dryomov Date: Sat, 27 Jul 2024 16:41:14 +0000 (+0200) Subject: script/backport-create-issue: handle ResourceAttrError when getting CF_TAGS X-Git-Tag: v20.0.0~1357^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F58883%2Fhead;p=ceph.git script/backport-create-issue: handle ResourceAttrError when getting CF_TAGS 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 --- diff --git a/src/script/backport-create-issue b/src/script/backport-create-issue index 4621411a101b..10ed843e2b36 100755 --- a/src/script/backport-create-issue +++ b/src/script/backport-create-issue @@ -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: