diff options
author | Peter Sprygada <privateip@users.noreply.github.com> | 2016-11-18 09:52:53 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-18 09:52:53 -0500 |
commit | 8d23e06074b2a42f5920f8b9e4a00ddd05002052 (patch) | |
tree | feea7dacd620b8ddb09ba082965def1f4280ca06 | |
parent | 9914626ce2dda7892119443e7ae95d71058345e5 (diff) | |
download | ansible-modules-core-revert-5428-fix_command_timeout.tar.gz |
Revert "ios_mods - added stdout to exception output. Removed to_lines()"revert-5428-fix_command_timeout
-rw-r--r-- | network/ios/ios_command.py | 11 | ||||
-rw-r--r-- | network/ios/ios_config.py | 2 |
2 files changed, 9 insertions, 4 deletions
diff --git a/network/ios/ios_command.py b/network/ios/ios_command.py index c5923e4e..4204a73a 100644 --- a/network/ios/ios_command.py +++ b/network/ios/ios_command.py @@ -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) diff --git a/network/ios/ios_config.py b/network/ios/ios_config.py index 4f6786ee..6c07d2cf 100644 --- a/network/ios/ios_config.py +++ b/network/ios/ios_config.py @@ -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) |