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

Traceback on invalid SSH key in digital_ocean_sshkey #68

Closed
mamercad opened this issue Apr 20, 2021 · 0 comments · Fixed by #89
Closed

Traceback on invalid SSH key in digital_ocean_sshkey #68

mamercad opened this issue Apr 20, 2021 · 0 comments · Fixed by #89
Labels
bug Something isn't working ci

Comments

@mamercad
Copy link
Collaborator

SUMMARY

In looking through the integration tests, I noticed a traceback when creating an invalid SSH key.

TASK [digital_ocean_sshkey : Create an invalid SSH key] ************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: IndexError: list index out of range
fatal: [testhost]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n  File \"/root/.ansible/tmp/ansible-tmp-1618943706.106942-1819-173224235158984/AnsiballZ_digital_ocean_sshkey.py\", line 143, in <module>\n    _ansiballz_main()\n  File \"/root/.ansible/tmp/ansible-tmp-1618943706.106942-1819-173224235158984/AnsiballZ_digital_ocean_sshkey.py\", line 135, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/root/.ansible/tmp/ansible-tmp-1618943706.106942-1819-173224235158984/AnsiballZ_digital_ocean_sshkey.py\", line 81, in invoke_module\n    runpy.run_module(mod_name='ansible_collections.community.digitalocean.plugins.modules.digital_ocean_sshkey', init_globals=None, run_name='__main__', alter_sys=True)\n  File \"/usr/lib/python3.8/runpy.py\", line 205, in run_module\n    return _run_module_code(code, init_globals, run_name, mod_spec)\n  File \"/usr/lib/python3.8/runpy.py\", line 95, in _run_module_code\n    _run_code(code, mod_globals, init_globals,\n  File \"/usr/lib/python3.8/runpy.py\", line 85, in _run_code\n    exec(code, run_globals)\n  File \"/tmp/ansible_community.digitalocean.digital_ocean_sshkey_payload_rdwn4ua1/ansible_community.digitalocean.digital_ocean_sshkey_payload.zip/ansible_collections/community/digitalocean/plugins/modules/digital_ocean_sshkey.py\", line 273, in <module>\n  File \"/tmp/ansible_community.digitalocean.digital_ocean_sshkey_payload_rdwn4ua1/ansible_community.digitalocean.digital_ocean_sshkey_payload.zip/ansible_collections/community/digitalocean/plugins/modules/digital_ocean_sshkey.py\", line 269, in main\n  File \"/tmp/ansible_community.digitalocean.digital_ocean_sshkey_payload_rdwn4ua1/ansible_community.digitalocean.digital_ocean_sshkey_payload.zip/ansible_collections/community/digitalocean/plugins/modules/digital_ocean_sshkey.py\", line 175, in core\n  File \"/tmp/ansible_community.digitalocean.digital_ocean_sshkey_payload_rdwn4ua1/ansible_community.digitalocean.digital_ocean_sshkey_payload.zip/ansible_collections/community/digitalocean/plugins/modules/digital_ocean_sshkey.py\", line 242, in ssh_key_fingerprint\nIndexError: list index out of range\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}
...ignoring
ISSUE TYPE
  • Bug Report
COMPONENT NAME
  • digital_ocean_sshkey
ANSIBLE VERSION
ansible 2.10.6
  config file = /Users/mmercado/.ansible.cfg
  configured module search path = ['/Users/mmercado/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/mmercado/.pyenv/versions/3.8.5/lib/python3.8/site-packages/ansible
  executable location = /Users/mmercado/.pyenv/versions/3.8.5/bin/ansible
  python version = 3.8.5 (default, Sep 29 2020, 11:04:46) [Clang 12.0.0 (clang-1200.0.31.1)]
CONFIGURATION
N/A
STEPS TO REPRODUCE

The traceback is visible in the output of the integration test, I'm sure it could be reproduced locally as well.

EXPECTED RESULTS

It would be nice to let the user know that the SSH key isn't valid, and, not have an exception.

ACTUAL RESULTS

Traceback.

@mamercad mamercad added bug Something isn't working ci labels Apr 20, 2021
mamercad pushed a commit that referenced this issue May 20, 2021
* Fix digital_ocean_sshkey traceback issue

* Fix linting errors
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ci
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant