[vagrant] openstack-ansible-lxc_hosts: The `lxc` module is not importable. Check the requirements."
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack-Ansible |
Fix Released
|
Undecided
|
Markos Chandras |
Bug Description
Hi,
Running 'vagrant up' on the openstack-
So my theory is that this is because lxc-python2 package is installed in the '.tox/functional' virtualenv instead of the real root. I also noticed that there is a major difference between the 'vagrant' and the OpenStack CI tox execution
In the OpenStack CI jobs [1] we observe the following
2017-03-31 19:30:26.222231 | "cmd": "/usr/bin/pip2 install -U lxc-python2",
but in vagrant we see the following
==> default: "cmd": "/vagrant/
So we see that a different 'pip' is used even though both environments use 'tox -e functional'. This probably results to 'lxc-python2' being installed int a wrong place.
Please let me know if you need me to provide more information but it's very easy to reproduce it with a simple 'vagrant up'
So a bit more information
It turns out what 'tox' prepends /vagrant/ .tox/install/ bin in $PATH. The resulting PATH in the vagrant system is
/vagrant/ .tox/install/ bin:/usr/ local/sbin: /usr/local/ bin:/usr/ sbin:/usr/ bin:/sbin: /bin:/snap/ bin
This probably results in finding the pip2 from /vagrant/ .tox/install/ bin instead of using the one from the host according to this
https:/ /github. com/ansible/ ansible/ blob/devel/ lib/ansible/ modules/ packaging/ language/ pip.py# L319
and this
https:/ /github. com/ansible/ ansible/ blob/devel/ lib/ansible/ module_ utils/basic. py#L1914
So basically, the pip module is trying to locate the 'pip' to use by calling the get_bin_path() method and this method iterates over the $PATH variable until it finds a suitable 'pip'
Of course this does not explain why in OpenStack CI it does not pick the pip from the .tox/$env directory. My only theory so far is that .tox/$env/bin/ does not have pip in it. I am not sure why. I am afraid that we need to have a look on one of the actual CI hosts to find out what's happening...