python - JIRA not recognizing dictionary object in cURL call -
this error getting while using jira-python python module automate logging jira.
traceback (most recent call last): file "/home/csd-user/test/libs/utils/butler.py", line 217, in <module> main() file "/home/csd-user/test/libs/utils/butler.py", line 214, in main b.log_bug_exec(url) file "/home/csd-user/test/libs/utils/butler.py", line 47, in log_bug_exec cls.process_file(stdout) file "/home/csd-user/test/libs/utils/butler.py", line 108, in process_file cls.submit_bug(bug) file "/home/csd-user/test/libs/utils/butler.py", line 207, in submit_bug iss = cls.my_server.create_issue(fields=bug.json_dict['fields']) file "/opt/clearsky/lib/python2.7/site-packages/jira/client.py", line 706, in create_issue r = self._session.post(url, data=json.dumps(data)) file "/opt/clearsky/lib/python2.7/site-packages/jira/resilientsession.py", line 81, in post return self.__verb('post', url, **kwargs) file "/opt/clearsky/lib/python2.7/site-packages/jira/resilientsession.py", line 74, in __verb raise_on_error(r, verb=verb, **kwargs) file "/opt/clearsky/lib/python2.7/site-packages/jira/utils.py", line 120, in raise_on_error r.status_code, error, r.url, request=request, response=r, **kwargs) # important part... jira.utils.jiraerror: jiraerror http 400 text: data not object url: https://jira.clearsky-data.net/rest/api/2/issue
my problem that, far can see, dict object passing valid.
bug fields :: {'environment': 'node => 62-qa-driver12 (m3 - ha only)\nversion => \nurl => https://jenkins.clearsky-data.net/job/bugloggertest/144/\ntimestamp => 2015-06-29_11-11-15\njob name => bugloggertest\nbuild number => 144\nversion number => not present. check git hash. maybe add in processing of full failure list!\n', 'description': '', 'summary': 'fill in something', 'project': {'key': 'qabl'}, 'assignee': 'qa-auto', 'issuetype': {'name': 'bug'}, 'priority': {'name': 'major'}} class :: <type 'dict'>
is formatted this...
# creating json object (bug should not have changed after initialization) self.json_dict = ( {"fields": { "project": {'key': self.project}, "issuetype": {'name': self.issue_type}, "priority": {'name': self.priority}, "assignee": self.assignee, "environment": self.environment, "description": self.description, "summary": self.summary } } )
this call create issue error being thrown...
iss = cls.my_server.create_issue(fields=bug.json_dict['fields']) # calls curl post or put command.
i'd love trying figure out. been banging head against wall day far. thanks!
your assignee not jira expects:
"assignee": self.assignee,
should read
"assignee": {'name': self.assignee}
i saw in update example
issue.update(summary='new summary', description='a new summary added') issue.update(assignee={'name': 'new_user'})
Comments
Post a Comment