Revert "ios_mods - added stdout to exception output. Removed to_lines()" (#5663)

This commit is contained in:
Peter Sprygada 2016-11-18 09:56:39 -05:00 committed by Matt Clay
parent 509846e6d6
commit 7079fe41be
2 changed files with 9 additions and 4 deletions

View file

@ -148,6 +148,12 @@ from ansible.module_utils.six import string_types
VALID_KEYS = ['command', 'prompt', 'response']
def to_lines(stdout):
for item in stdout:
if isinstance(item, string_types):
item = str(item).split('\n')
yield item
def parse_commands(module):
for cmd in module.params['commands']:
if isinstance(cmd, string_types):
@ -210,9 +216,7 @@ def main():
module.fail_json(msg=str(exc), failed_conditions=exc.failed_conditions)
except NetworkError:
exc = get_exception()
module.disconnect()
module.fail_json(msg=str(exc), stdout=exc.kwargs.get('stdout'))
module.fail_json(msg=str(exc))
result = dict(changed=False, stdout=list())
@ -224,6 +228,7 @@ def main():
result['stdout'].append(output)
result['warnings'] = warnings
result['stdout_lines'] = list(to_lines(result['stdout']))
module.exit_json(**result)

View file

@ -391,7 +391,7 @@ def main():
except NetworkError:
exc = get_exception()
module.disconnect()
module.fail_json(msg=str(exc), stdout=exc.kwargs.get('stdout'))
module.fail_json(msg=str(exc))
module.disconnect()
module.exit_json(**result)