How do you set the fixVersions field using jira-python

戏子无情 提交于 2019-12-22 18:15:42

问题


I'm trying to update an existing JIRA using the jira-python module (http://jira-python.readthedocs.org/en/latest/). Specifically I'm trying to set the fixesVersion list of an issue. I've been trying for a while with no luck. What am I missing?

issue = jira.issue('DUC-391')
issue_dict = { 'fixVersions' : [{'id': '10115'}] }
issue.update(fields=issue_dict)

Returned stackTrace:

Traceback (most recent call last):
  File "post-commit-jira.py", line 35, in <module>
    issue.update(fields=issue_dict)
  File "/Library/Python/2.6/site-packages/jira/resources.py", line 193, in update
    super(Issue, self).update(**data)
  File "/Library/Python/2.6/site-packages/jira/resources.py", line 72, in update
    raise_on_error(r)
  File "/Library/Python/2.6/site-packages/jira/exceptions.py", line 29, in raise_on_error
    error = errorMessages[0]

回答1:


Take a look at the example of add, set and remove for components in https://developer.atlassian.com/display/JIRADEV/JIRA+REST+API+Example+-+Edit+issues You can use the name instead of the id which is helpful, e.g.

issue_dict = { 'fixVersions' : [{'add': {'name': 'Name of the version 10115'}}] }



回答2:


Played around more with it, realized the error.

It was failing due to some required fields being unset. Code snipped in the original question is ok, error reporting from the jira-python library however leaves a lot to be desired...



来源:https://stackoverflow.com/questions/14495448/how-do-you-set-the-fixversions-field-using-jira-python

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!