Ensure __pycache__ folder is deleted
In some cases when running python3, the cleanup of the virtualenv is incomplete: While the *.pyc files are removed, the python3 __pycache__ folder is not removed. That causes the sed instruction (applying to files) to fail, as the __pycache__ folder is not a regular file, but a folder. With the sed not successfully running, the shebang of the virtualenv is pointing to an incorrect location, causing then a failure in keystone-manage commands. On top of it, a success would happen should the last command return 0. We now make sure the whole script must return success. This should fix the problem. Change-Id: I2999f9253e8bb70854e02768aef13f3b57839987
This commit is contained in:
parent
86d1369e19
commit
d021c51c48
|
@ -93,7 +93,9 @@
|
|||
# to https://github.com/pypa/virtualenv/issues/565
|
||||
- name: Update virtualenv path
|
||||
shell: |
|
||||
set -o errexit
|
||||
find {{ heat_bin }} -name \*.pyc -delete
|
||||
if test -d {{ heat_bin }}/__pycache__; then rmdir {{ heat_bin }}/__pycache__; fi
|
||||
sed -si '1s/^.*python.*$/#!{{ heat_bin | replace ('/','\/') }}\/python/' {{ heat_bin }}/*
|
||||
virtualenv {{ heat_bin | dirname }} \
|
||||
{{ (ansible_pkg_mgr == 'apt') | ternary('--always-copy', '') }} \
|
||||
|
|
Loading…
Reference in New Issue