Hello - i'm attempting to create a script to incorporate in our Cloud based app to create an issue within Jira using the Python Module .
When i run the following code I recieve the below error.
new_issue = jira.create_issue(project='OPS', summary="Savage-Test", description="savage-test", issuetype={"name": "Request"}, components=[{"Name": "SysAdmin-VMware"}],fields={'customfield_11107': [{'value': 'Not Applicable'}]})
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
/usr/lib/python2.7/site-packages/jira/jirashell.pyc in <module>()
----> 1 new_issue = jira.create_issue(project='OPS', summary="Savage-Test", description="savage-test", issuetype={"name": "Request"}, components=[{"Name": "SysAdmin-VMware"}],fields={'customfield_11107': [{'value': 'Not Applicable'}]})
/usr/lib/python2.7/site-packages/jira/client.pyc in create_issue(self, fields, prefetch, **fieldargs)
885 data = _field_worker(fields, **fieldargs)
886
--> 887 p = data['fields']['project']
888
889 if isinstance(p, string_types) or isinstance(p, integer_types):
KeyError: u'project'
The customfield_11107 is a required field to create issues within the SysAdmin-VMware component.
Thoughts?
Hi Adam,
When I try to create an issue by passing the values for an issue (project, summary, description, issue type, etc) I receive the same KeyError. I noticed you raised this issue on the Github page for the repository, and I attempted to use the method in the answer without success. I was able to change the method for defining the data on the custom field to successfully create the issue. Passing the create_issue method a dictionary of values like the following should work. I hope that helps!
issue_dict = {
'project': {'key': 'OPS'},
'summary': 'Savage-Test',
'description': 'savage-test',
'issuetype': {'name': 'Request'},
'customfield_11107': 'Not Applicable'
}
new_issue = jira.create_issue(fields=issue_dict)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.