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

Digital Ocean SSH keys error while decoding Base64. #36968

Merged
merged 1 commit into from Mar 3, 2018

Conversation

pmarques
Copy link
Contributor

@pmarques pmarques commented Mar 3, 2018

SUMMARY

Python 3 base64 decodestring expects a bytes-like object, not a string.

TypeError: expected bytes-like object, not str
ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

digital_ocean_sshkey.py

ANSIBLE VERSION
ansible 2.4.3.0

previous versions are also affected.

ADDITIONAL INFORMATION

Full stack trace when running with python 3

Traceback (most recent call last):
  File "/var/folders/3w/knmcr7_d49183rwvzq_mfmlm0000gn/T/ansible_64vql_7d/ansible_module_digital_ocean_sshkey.py", line 272, in <module>
    main()
  File "/var/folders/3w/knmcr7_d49183rwvzq_mfmlm0000gn/T/ansible_64vql_7d/ansible_module_digital_ocean_sshkey.py", line 268, in main
    core(module)
  File "/var/folders/3w/knmcr7_d49183rwvzq_mfmlm0000gn/T/ansible_64vql_7d/ansible_module_digital_ocean_sshkey.py", line 171, in core
    fingerprint = fingerprint or ssh_key_fingerprint(ssh_pub_key)
  File "/var/folders/3w/knmcr7_d49183rwvzq_mfmlm0000gn/T/ansible_64vql_7d/ansible_module_digital_ocean_sshkey.py", line 239, in ssh_key_fingerprint
    base64.decodestring(key)
  File "/usr/local/Cellar/python/3.6.4_3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/base64.py", line 561, in decodestring
    return decodebytes(s)
  File "/usr/local/Cellar/python/3.6.4_3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/base64.py", line 552, in decodebytes
    _input_type_check(s)
  File "/usr/local/Cellar/python/3.6.4_3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/base64.py", line 520, in _input_type_check
    raise TypeError(msg) from err
TypeError: expected bytes-like object, not str

```
TypeError: expected bytes-like object, not str
```
@ansibot
Copy link
Contributor

ansibot commented Mar 3, 2018

@ansibot ansibot added bug This issue/PR relates to a bug. cloud community_review In order to be merged, this PR must follow the community review workflow. digital_ocean module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. owner_pr This PR is made by the module's maintainer. python3 support:community This issue/PR relates to code supported by the Ansible community. labels Mar 3, 2018
@BondAnthony
Copy link
Contributor

LGTM

@pmarques thank you!

@ansibot ansibot added automerge This PR was automatically merged by ansibot. shipit This PR is ready to be merged by Core and removed community_review In order to be merged, this PR must follow the community review workflow. needs_triage Needs a first human triage before being processed. labels Mar 3, 2018
@ansibot ansibot merged commit 83aaa81 into ansible:devel Mar 3, 2018
willthames pushed a commit to willthames/ansible that referenced this pull request Mar 6, 2018
```
TypeError: expected bytes-like object, not str
```
@ansible ansible locked and limited conversation to collaborators Apr 27, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
automerge This PR was automatically merged by ansibot. bug This issue/PR relates to a bug. cloud digital_ocean module This issue/PR relates to a module. owner_pr This PR is made by the module's maintainer. python3 shipit This PR is ready to be merged by Core support:community This issue/PR relates to code supported by the Ansible community.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants