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)
* 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>
This commit is contained in:
parent
40ffd559ac
commit
e6c773a4f3
2 changed files with 10 additions and 1 deletions
2
changelogs/fragments/3867-jira-fix-body.yaml
Normal file
2
changelogs/fragments/3867-jira-fix-body.yaml
Normal 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).
|
|
@ -694,7 +694,14 @@ class JIRA(StateModuleHelper):
|
|||
try:
|
||||
error = json.loads(info['body'])
|
||||
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:
|
||||
msg = []
|
||||
for key in ('errorMessages', 'errors'):
|
||||
|
|
Loading…
Reference in a new issue