From 48e0cbc2f6ad16fd83a3b76a4e6593aee71f3997 Mon Sep 17 00:00:00 2001 From: sidpremkumar Date: Sep 09 2019 22:55:51 +0000 Subject: Add comment when attempting to transition to CUSTOM_STATE --- diff --git a/sync2jira/downstream.py b/sync2jira/downstream.py index f6eaac5..39fdd5f 100644 --- a/sync2jira/downstream.py +++ b/sync2jira/downstream.py @@ -740,10 +740,13 @@ def _update_transition(client, existing, issue): except ValueError: # for python 2.7 closed_status = (filter(lambda d: "transition" in d, issue.downstream.get('updates', {})))[0]['transition'] - if closed_status is not True and issue.status == 'Closed' \ and existing.fields.status.name.upper() != closed_status.upper(): - # Now we need to update the status of the JIRA issue\ + # Now we need to update the status of the JIRA issue + # First add a comment indicating the change (in case it doesn't go through) + hyperlink = f"[Upstream issue|{issue.url}]" + comment_body = f"{hyperlink} closed. Attempting transition to {closed_status}." + client.add_comment(existing, comment_body) # Ensure that closed_status is a valid choice # Find all possible transactions (i.e. change states) we could `do _change_status(client, existing, closed_status, issue)