1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

jira - fixed 'body' dict key error (#3867) (#3913)

* fixed

* added changelog fragment

* improved fail output when placing JIRA API requests

* Update plugins/modules/web_infrastructure/jira.py

Co-authored-by: Felix Fontein <felix@fontein.de>

Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit e6c773a4f3)

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
This commit is contained in:
patchback[bot] 2021-12-17 22:13:21 +01:00 committed by GitHub
parent c055ea2bcc
commit 8df1b93531
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 1 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- jira - fixed bug where module returns error related to dictionary key ``body`` (https://github.com/ansible-collections/community.general/issues/3419).

View file

@ -669,7 +669,14 @@ class JIRA(StateModuleHelper):
try: try:
error = json.loads(info['body']) error = json.loads(info['body'])
except Exception: except Exception:
self.module.fail_json(msg=to_native(info['body']), exception=traceback.format_exc()) msg = 'The request "{method} {url}" returned the unexpected status code {status} {msg}\n{body}'.format(
status=info['status'],
msg=info['msg'],
body=info.get('body'),
url=url,
method=method,
)
self.module.fail_json(msg=to_native(msg), exception=traceback.format_exc())
if error: if error:
msg = [] msg = []
for key in ('errorMessages', 'errors'): for key in ('errorMessages', 'errors'):