mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Provide more debug output on failures (#35961)
This PR includes: - payload output on failure, when requested - add additional kwargs to aci.exit_json() We may want to enable some of this debug output by default on failure ?
This commit is contained in:
parent
80e1e0b017
commit
3693e560dc
1 changed files with 9 additions and 1 deletions
|
@ -918,7 +918,7 @@ class ACIModule(object):
|
|||
self.result['changed'] = True
|
||||
self.method = 'POST'
|
||||
|
||||
def exit_json(self):
|
||||
def exit_json(self, **kwargs):
|
||||
|
||||
if self.params['output_level'] in ('debug', 'info'):
|
||||
self.result['previous'] = self.existing
|
||||
|
@ -947,6 +947,7 @@ class ACIModule(object):
|
|||
self.result['sent'] = self.config
|
||||
self.result['proposed'] = self.proposed
|
||||
|
||||
self.result.update(**kwargs)
|
||||
self.module.exit_json(**self.result)
|
||||
|
||||
def fail_json(self, msg, **kwargs):
|
||||
|
@ -955,6 +956,9 @@ class ACIModule(object):
|
|||
if self.error['code'] is not None and self.error['text'] is not None:
|
||||
self.result['error'] = self.error
|
||||
|
||||
if self.params['output_level'] in ('debug', 'info'):
|
||||
self.result['previous'] = self.existing
|
||||
|
||||
# Return the gory details when we need it
|
||||
if self.params['output_level'] == 'debug':
|
||||
if self.imdata is not None:
|
||||
|
@ -969,5 +973,9 @@ class ACIModule(object):
|
|||
self.result['status'] = self.status
|
||||
self.result['url'] = self.url
|
||||
|
||||
if self.params['output_level'] in ('debug', 'info'):
|
||||
self.result['sent'] = self.config
|
||||
self.result['proposed'] = self.proposed
|
||||
|
||||
self.result.update(**kwargs)
|
||||
self.module.fail_json(msg=msg, **self.result)
|
||||
|
|
Loading…
Reference in a new issue