From b0df38c46dd013385448ec6d48a3d31998800eef Mon Sep 17 00:00:00 2001 From: Olivier Bourdon Date: Wed, 4 Jul 2018 12:49:01 +0200 Subject: [PATCH] Fix uwsgi configuration when using venv Without this fix, the following step will fail bifrost-ironic-install : Ensure service project is present and you will have errors in uwsgi like ...: Traceback (most recent call last): ...: File "/var/www/keystone/public", line 6, in ...: from keystone.server.wsgi import initialize_public_application ...: ImportError: No module named keystone.server.wsgi (extracted from journalctl -u uwsgi output) Change-Id: If238ceb3d6309e491235aa63e1adccd7d0606be3 --- playbooks/roles/bifrost-keystone-install/tasks/bootstrap.yml | 1 + .../bifrost-keystone-install/templates/keystone-admin.ini.j2 | 3 +++ .../bifrost-keystone-install/templates/keystone-public.ini.j2 | 3 +++ 3 files changed, 7 insertions(+) diff --git a/playbooks/roles/bifrost-keystone-install/tasks/bootstrap.yml b/playbooks/roles/bifrost-keystone-install/tasks/bootstrap.yml index b6869cbc7..e37d716a7 100644 --- a/playbooks/roles/bifrost-keystone-install/tasks/bootstrap.yml +++ b/playbooks/roles/bifrost-keystone-install/tasks/bootstrap.yml @@ -16,6 +16,7 @@ - name: "If VENV is set in the environment, enable installation into venv" set_fact: enable_venv: true + uwsgi_venv: "{{ bifrost_venv_env.get('VIRTUAL_ENV', '') }}" when: lookup('env', 'VENV') | length > 0 - name: "Get uwsgi install location" diff --git a/playbooks/roles/bifrost-keystone-install/templates/keystone-admin.ini.j2 b/playbooks/roles/bifrost-keystone-install/templates/keystone-admin.ini.j2 index 3e0b3156e..7aa377fa8 100644 --- a/playbooks/roles/bifrost-keystone-install/templates/keystone-admin.ini.j2 +++ b/playbooks/roles/bifrost-keystone-install/templates/keystone-admin.ini.j2 @@ -6,6 +6,9 @@ threads = 2 plugin = python no-orphans = true chmod-socket = 660 +{% if uwsgi_venv is defined and uwsgi_venv | length > 0 %} +virtualenv = {{ uwsgi_venv }} +{% endif %} socket = /run/uwsgi/keystone-admin.socket pidfile = /run/uwsgi/keystone-admin.pid diff --git a/playbooks/roles/bifrost-keystone-install/templates/keystone-public.ini.j2 b/playbooks/roles/bifrost-keystone-install/templates/keystone-public.ini.j2 index 8641ae18c..58e00e526 100644 --- a/playbooks/roles/bifrost-keystone-install/templates/keystone-public.ini.j2 +++ b/playbooks/roles/bifrost-keystone-install/templates/keystone-public.ini.j2 @@ -6,6 +6,9 @@ threads = 2 plugin = python no-orphans = true chmod-socket = 660 +{% if uwsgi_venv is defined and uwsgi_venv | length > 0 %} +virtualenv = {{ uwsgi_venv }} +{% endif %} socket = /run/uwsgi/keystone-public.socket pidfile = /run/uwsgi/keystone-public.pid