ansible / ansible

Ansible is a radically simple IT automation platform that makes your applications and systems easier to deploy and maintain. Automate everything from code deployment to network configuration to cloud management, in a language that approaches plain English, using SSH, with no agents to install on remote systems. https://docs.ansible.com.
https://www.ansible.com/
GNU General Public License v3.0
62.72k stars 23.87k forks source link

Lastpass lookup failure on python 3 #42062

Closed dannyim closed 5 years ago

dannyim commented 6 years ago
SUMMARY

Lastpass lookup plugin fails on python 3 due to the subprocess module returning a byte sequence instead of a string.

ISSUE TYPE
COMPONENT NAME

lastpass

ANSIBLE VERSION
ansible 2.6.0 (devel 3dee0b67e8) last updated 2018/04/12 14:14:38 (GMT -500)
  config file = None
  configured module search path = ['/home/imxxx021/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /c/Users/imxxx021/wsl/projects/ansible/lib/ansible
  executable location = /c/Users/imxxx021/wsl/projects/ansible/bin/ansible
  python version = 3.5.2 (default, Nov 23 2017, 16:37:01) [GCC 5.4.0 20160609]
CONFIGURATION

ANSIBLE_NOCOLOR(env: ANSIBLE_NOCOLOR) = True

OS / ENVIRONMENT

Ubuntu 16.04.4 LTS via WSL on Windows 10 Enterprise (version 1709)

STEPS TO REPRODUCE
---
- hosts: localhost
  vars:
    maven_username: "{{ lookup('lastpass', 'Artifactory maven account', field='username') }}"
EXPECTED RESULTS

The value of the field from lastpass

ACTUAL RESULTS
fatal: [localhost]: FAILED! => {"msg": "An unhandled exception occurred while running the lookup plugin 'template'. Error was a <class 'ansible.errors.AnsibleError'>, original message: An unhandled exception occurred while templating '{{ lookup('lastpass', 'Artifactory maven account', field='username') }}'. Error was a <class 'ansible.errors.AnsibleError'>, original message: An unhandled exception occurred while running the lookup plugin 'lastpass'. Error was a <class 'TypeError'>, original message: memoryview: a bytes-like object is required, not 'str'"}
ansibot commented 6 years ago

Files identified in the description:

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

alexthemitchell commented 6 years ago

Reproducible in 2.7:

ansible 2.7.0
  config file = None
  configured module search path = ['/Users/alexthemitchell/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/Cellar/ansible/2.7.0/libexec/lib/python3.7/site-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 3.7.0 (default, Jul 23 2018, 20:22:55) [Clang 9.1.0 (clang-902.0.39.2)]
alexthemitchell commented 6 years ago

Hey @azenk, could you check out this bug?