0

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.

Astormooke
  • 71
  • 7
  • Are you getting any error in your output? – pjmaracs Jul 19 '19 at 14:33
  • No error, exits clean. Should be known that attempting an comment_a.update(body="Hello World") results in a AttributeError: object has no attribute 'self' ('Comment' object is not subscriptable) – Astormooke Jul 19 '19 at 14:41
  • would you mind running `comments_b = jira.comments(issue)` and printing what that gives you before updating the ocmment that throws the error – pjmaracs Jul 19 '19 at 15:30
  • Printing the raw of this contains sensitive data, but I did install a local Jira instance and am able to post comments to issues there, just not on the remote server. The object created using the remote server connected Jira object add_comment doesn't have a 'Body' field in the JSON – Astormooke Jul 19 '19 at 15:36
  • I'd suggest doing whatever you can to print the full JSON and go from there. I've manually used python with JIRA but I've never used the jira library so I don't know everything thats going on under the hood. It could be the way that your org/company set up your jira instance where the library is trying to post and read from fields that aren't there – pjmaracs Jul 19 '19 at 15:39
  • Thank you for your help – Astormooke Jul 19 '19 at 15:41
  • let me know if this is the case, I'm curious myself. Personally, the auth in this library doesn't even work for my companies version of JIRA due to how its configured – pjmaracs Jul 19 '19 at 15:49
  • Ok so I think it might be a configuration issue, I do not have control over the remote server so I cannot configure it, the add_comment method is returning a list of comments already on the issue. The reason I didn't think it was an authentication issue is because I can update fields. Is there any chance you could point me in the direction of how you managed to connect and update Jira issues without using the web interface? – Astormooke Jul 19 '19 at 15:57
  • Disregard, interestingly enough the system admin is using a different field to add comments to the issue -- Found the field and now it is working! – Astormooke Jul 19 '19 at 16:01

1 Answers1

0

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

Astormooke
  • 71
  • 7
  • yeah I thought it would have something to do with the library trying to do something different than how the sys admins set it up. Good to know – pjmaracs Jul 19 '19 at 17:10