Hey Brian and Greg,
Thanks for the feedback. I run Arch Linux, where python3 is the default python. For this reason, I’ve tried getting the Ansible hacking setup both in a python2 virtualenv and in a python2 docker image. Both result in the same issue.
This is the output of which python and env python in my Docker image:
`
root@939639e10ec5:/code# which python
/usr/local/bin/python
root@939639e10ec5:/code# python
Python 2.7.12 (default, Nov 17 2016, 22:18:11)
[GCC 4.9.2] on linux2
Type “help”, “copyright”, “credits” or “license” for more information.
exit()
root@939639e10ec5:/code# env python
Python 2.7.12 (default, Nov 17 2016, 22:18:11)
[GCC 4.9.2] on linux2
Type “help”, “copyright”, “credits” or “license” for more information.
exit()
root@939639e10ec5:/code#
`
As you can see, python points to the right python executable. I’m using the official python2 Docker image and have installed the necessary dependencies. This is the Dockerfile:
`
FROM python:2
RUN pip install paramiko PyYAML Jinja2 httplib2 six
RUN apt-get update && apt-get install -y libvirt-dev
&& pip install libvirt-python
RUN pip install boto boto3
VOLUME /code
WORKDIR /code
VOLUME /data
CMD [“bash”]
`
I then load then Ansible repo under /data.
I ran the setup module and it confirms the python executable being 2.7.12:
`
root@c52acee259c9:/code# ansible localhost -m setup -a filter=ansible_env
[WARNING]: Host file not found: /etc/ansible/hosts
[WARNING]: provided hosts list is empty, only localhost is available
localhost | SUCCESS => {
“ansible_facts”: {
“ansible_env”: {
“ANSIBLE_HOME”: “/code”,
“GPG_KEY”: “C01E1CAD5EA2C4F0B8E3571504C367C218ADD4FF”,
“HOME”: “/root”,
“HOSTNAME”: “c52acee259c9”,
“LANG”: “C.UTF-8”,
“MANPATH”: “/code/docs/man:”,
“PATH”: “/code/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin”,
“PWD”: “/code”,
“PYTHONPATH”: “/code/lib:”,
“PYTHON_PIP_VERSION”: “9.0.1”,
“PYTHON_VERSION”: “2.7.12”,
“SHLVL”: “1”,
“TERM”: “xterm”,
“_”: “/code/bin/ansible”
}
},
“changed”: false
}
`
Any more ideas?
Regards,
Simon