Search code examples
python-3.xpython-jira

Comment not posting when using jira.add_comment


I am trying to write a simple interface with my Jira board, I have connection with basic_auth and am able to retrieve a issue using jira.issue('ISSUE NAME') however calling jira.add_comment(issue, "Hello World") results in no comment being posted to the board.

I have ensured that I can see the other comments on the issue by printing their bodies, I am able to update other fields including the other comments with new text.

from jira import JIRA
import re

# By default, the client will connect to a JIRA instance started from the Atlassian Plugin SDK
# (see https://developer.atlassian.com/display/DOCS/Installing+the+Atlassian+Plugin+SDK for details).
# Override this with the options parameter.
options = {
    'server': 'https://jira.personal-server.com'}
jira = JIRA(options,basic_auth=('USER','PASS'))

# Get an issue.
issue = jira.issue('ISSUE-TITLE')

# Add a comment to the issue.
comment_a = jira.add_comment(issue,"Hello World")

I expect to see a comment on the web interface with the text "Hello World", instead I get no change at all.

Also, an attempted:

comment_a.update(body="HEllo?")

resulted in:

AttributeError: <class 'jira.resources.Comment'> object has no attribute 'self' ('Comment' object is not subscriptable)

SOLUTION:

JIRA admin is using a custom field to manage comment input, which means that all I have to do is find the issue and update it.


Solution

  • Comments are updated using a field rather than the default JIRA comment REST method, found the field and updated it through the issue object.