ansible / ansible-container

DEPRECATED -- Ansible Container was a tool to build Docker images and orchestrate containers using only Ansible playbooks.
GNU Lesser General Public License v3.0
2.19k stars 392 forks source link

Ansible container is not compatible with Pip10 #940

Closed brianbruggeman closed 6 years ago

brianbruggeman commented 6 years ago

More or less:

$ pip install --upgrade pip $ pip install ansible-container[docker,k8s]

dchsueh commented 6 years ago

workaround it in a virtualenv

(setup virtualenv and activate)
pip --disable-pip-version-check install pip==9.0.3
pip --disable-pip-version-check install setuptools==39.2.0
pip --disable-pip-version-check install docker==2.7.0
pip --disable-pip-version-check install ansible-container[docker,k8s]==(whateverversion)
sed -i "s/filters={'name': self.secrets_volume_name}//g" /usr/local/lib/python2.7/dist-packages/container/docker/secrets.py
sed -i "s/return os.path.join(os.sep, 'run', 'secrets')/return os.path.join(os.sep, 'docker', 'secrets')/g" /usr/local/lib/python2.7/dist-packages/container/docker/engine.py

note the above path "/usr/local/lib/python2.7/dist-packages" is a direct install directory for ubuntu (xenial) you would use "/usr/lib/python2.7/site-packages" for a direct install on centos 7 directory will vary depending on your virtualenv environment location

sed filters line addresses ansible-container bug described in https://github.com/moby/moby/issues/34121 sed return line is workaround for https://github.com/ansible/ansible-container/issues/762

brianbruggeman commented 6 years ago

This makes no sense... it appears to be addressing a completely different problem. The issue is that pip10 has a completely different structure (pip._internal.req in pip10 vs pip.req in pip9). Additionally, floating old or pinned versions is at best a patch for an immediate "now" and not a long term fix or one that anyone should apply in a production system.

dchsueh commented 6 years ago

If you create a virtualenv and prep it with pip==9.0.3 and then set up your ansible-container install, you will end up with a python environment with various packages pinned to specific versions that the current ansible-container 0.9.2 works well with.

(I added extra fixes for other problems I've run into as well as I believe you will need them, but if it makes it look like I'm not addressing the "pip version" problem, then ignore the extra lines for now.)

dchsueh commented 6 years ago

(I'll add a subsequent comment so the discussion thread progresses as you read subsequent comments in sequence)

I supposed I should have prefaced my original workaround with something like "if anyone needs an ansible-container setup working now, you can do this..."

I understand what the problem comes from. But unless you install ansible-container from source using a checkout with corrected source code, you are stuck with what pip can get retrieve for you, which is 0.9.2 and 0.9.3rc0 I believe.

And the workaround might help other people continue working rather than file another issue.

When an official 0.9.3 is released that fixes various issues, I will update my environments to the new version and remove the workarounds needed previously.

Voronenko commented 6 years ago

Fix for pip10 was merged into develop