Do not symlink the __pycache__ directory into the venv

If a service is already started it will create files in the venv
__pycache__ directory. This role will then try to symlink the non empty
directory to the host, which will fail.

"the directory /openstack/venvs/nova-19.1.0.dev272/lib/python3.6/
site-packages/__pycache__ is not empty, refusing to convert it"

This patch stops any __pycache__ files from being symlinked to the
venv, these appear to be present in suse packages [1].

[1] http://paste.openstack.org/show/773974/

Change-Id: Ib718f5de4e5ae5b401858dea6437e0039b7082e0
This commit is contained in:
Jonathan Rosser 2019-09-09 11:25:13 +01:00
parent db722a833d
commit 4d47c1ed04

View File

@ -178,6 +178,7 @@
shell: >-
{{ (ansible_pkg_mgr == 'apt') | ternary('dpkg -L ' ~ (venv_packages_to_symlink | join(' ')), 'rpm -ql ' ~ (venv_packages_to_symlink | join(' ')) ) }}
| egrep '^.*{{ venv_python_major_version }}.*/(site|dist)-packages/.*'
| egrep -v "__pycache__"
args:
warn: no
changed_when: false