-
Notifications
You must be signed in to change notification settings - Fork 91
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
routeros: Bug fix: Exception catching #27
routeros: Bug fix: Exception catching #27
Conversation
The function get_capabilities was failing to catch connections exceptions, what make an ugly output OUTPUT BEFORE CHANGES: The full traceback is: Traceback (most recent call last): File "/root/.ansible/tmp/ansible-local-20843l7aphwz5/ansible-tmp-1588555470.4121525-264386939405924/AnsiballZ_routeros_comle> _ansiballz_main() File "/root/.ansible/tmp/ansible-local-20843l7aphwz5/ansible-tmp-1588555470.4121525-264386939405924/AnsiballZ_routeros_comallz_main invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS) File "/root/.ansible/tmp/ansible-local-20843l7aphwz5/ansible-tmp-1588555470.4121525-264386939405924/AnsiballZ_routeros_com_module runpy.run_module(mod_name='ansible.modules.network.routeros.routeros_command', init_globals=None, run_name='__main__', a File "/usr/lib64/python2.7/runpy.py", line 176, in run_module fname, loader, pkg_name) File "/usr/lib64/python2.7/runpy.py", line 82, in _run_module_code mod_name, mod_fname, mod_loader, pkg_name) File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code exec code in run_globals File "/tmp/ansible_routeros_command_payload_XbsRY1/ansible_routeros_command_payload.zip/ansible/modules/network/routeros/r7, in <module> File "/tmp/ansible_routeros_command_payload_XbsRY1/ansible_routeros_command_payload.zip/ansible/modules/network/routeros/r7, in main File "/tmp/ansible_routeros_command_payload_XbsRY1/ansible_routeros_command_payload.zip/ansible/module_utils/network/routein run_commands File "/tmp/ansible_routeros_command_payload_XbsRY1/ansible_routeros_command_payload.zip/ansible/module_utils/network/routen get_connection File "/tmp/ansible_routeros_command_payload_XbsRY1/ansible_routeros_command_payload.zip/ansible/module_utils/network/routen get_capabilities File "/tmp/ansible_routeros_command_payload_XbsRY1/ansible_routeros_command_payload.zip/ansible/module_utils/connection.py ansible.module_utils.connection.ConnectionError: Failed to authenticate: Authentication failed. fatal: [MK]: FAILED! => changed=false module_stderr: |- Traceback (most recent call last): File "/root/.ansible/tmp/ansible-local-20843l7aphwz5/ansible-tmp-1588555470.4121525-264386939405924/AnsiballZ_routerosmodule> _ansiballz_main() File "/root/.ansible/tmp/ansible-local-20843l7aphwz5/ansible-tmp-1588555470.4121525-264386939405924/AnsiballZ_routerosnsiballz_main invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS) File "/root/.ansible/tmp/ansible-local-20843l7aphwz5/ansible-tmp-1588555470.4121525-264386939405924/AnsiballZ_routerosvoke_module runpy.run_module(mod_name='ansible.modules.network.routeros.routeros_command', init_globals=None, run_name='__main__ File "/usr/lib64/python2.7/runpy.py", line 176, in run_module fname, loader, pkg_name) File "/usr/lib64/python2.7/runpy.py", line 82, in _run_module_code mod_name, mod_fname, mod_loader, pkg_name) File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code exec code in run_globals File "/tmp/ansible_routeros_command_payload_XbsRY1/ansible_routeros_command_payload.zip/ansible/modules/network/routere 187, in <module> File "/tmp/ansible_routeros_command_payload_XbsRY1/ansible_routeros_command_payload.zip/ansible/modules/network/routere 157, in main File "/tmp/ansible_routeros_command_payload_XbsRY1/ansible_routeros_command_payload.zip/ansible/module_utils/network/r25, in run_commands File "/tmp/ansible_routeros_command_payload_XbsRY1/ansible_routeros_command_payload.zip/ansible/module_utils/network/r5, in get_connection File "/tmp/ansible_routeros_command_payload_XbsRY1/ansible_routeros_command_payload.zip/ansible/module_utils/network/r9, in get_capabilities File "/tmp/ansible_routeros_command_payload_XbsRY1/ansible_routeros_command_payload.zip/ansible/module_utils/connectio ansible.module_utils.connection.ConnectionError: Failed to authenticate: Authentication failed. module_stdout: '' msg: |- MODULE FAILURE See stdout/stderr for the exact error rc: 1 OUTPUT AFTER CHANGES fatal: [MK]: FAILED! => changed=false msg: 'Failed to authenticate: Authentication failed.'
This needs a changelog fragment ( CC @heuels |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@heuels if you have a bit of time, could you please review this PR? thanks :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
@felixfontein, sorry for a slight delay :) |
@renatoalmeidaoliveira thanks for the contribution! |
SUMMARY
The function get_capabilities was failing to catch connections exceptions, what make an ugly output
ISSUE TYPE
COMPONENT NAME
routeros.py
ADDITIONAL INFORMATION
This error can be reproduced simply by providing an invalid username/password
OUTPUT BEFORE CHANGES:
OUTPUT AFTER CHANGES