Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ACI: Provide more debug output on failures #35961

Merged
merged 1 commit into from
Feb 9, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 9 additions & 1 deletion lib/ansible/module_utils/network/aci/aci.py
Original file line number Diff line number Diff line change
Expand Up @@ -918,7 +918,7 @@ def post_config(self):
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
Expand Down Expand Up @@ -947,6 +947,7 @@ def exit_json(self):
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):
Expand All @@ -955,6 +956,9 @@ def fail_json(self, msg, **kwargs):
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:
Expand All @@ -969,5 +973,9 @@ def fail_json(self, msg, **kwargs):
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)