Remove venv activation code

This commit uses the pattern established in [1] to remove the venv
activation code by using the correct venv Python interpreter instead.

Note that using python-path in openstack_dashboard.conf.j2 does not
achieve full isolation from the host's python installation as we'd hope
(the path will still include /usr/local/lib/python2.7/dist-packages and
/usr/lib/python2.7/dist-packages), but every attempt at using
python-home failed due to the venv interpreter not being able to find
argparse.  We will need to spend some additional cycles here trying to
solve this as locking the venv interpreter into its own site-packages
is the best solution long-term.

[1] https://review.openstack.org/#/c/273943/

Change-Id: I0fbb8b9b070d1a0ab5cd55abfcc6587a0cd8957d
This commit is contained in:
Matt Thompson 2016-03-03 13:50:44 +00:00
parent 8c21de8612
commit 7d01073884
3 changed files with 4 additions and 19 deletions

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!{{ horizon_venv_enabled | bool | ternary(horizon_venv_bin + "/", "/usr/bin/env ") }}python
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
@ -13,14 +13,6 @@
# under the License.
import os
{% if horizon_venv_enabled | bool %}
activate_this = os.path.expanduser("{{ horizon_venv_bin }}/activate_this.py")
execfile(activate_this, dict(__file__=activate_this))
{% endif %}
import sys
from django.core.management import execute_from_command_line # noqa

View File

@ -1,13 +1,5 @@
import logging
import os
{% if horizon_venv_enabled | bool %}
activate_this = os.path.expanduser("{{ horizon_venv_bin }}/activate_this.py")
execfile(activate_this, dict(__file__=activate_this))
{% endif %}
import sys
from django.core.wsgi import get_wsgi_application
from django.conf import settings
@ -19,4 +11,4 @@ sys.stdout = sys.stderr
DEBUG = False
application = get_wsgi_application()
application = get_wsgi_application()

View File

@ -31,7 +31,8 @@
SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown
WSGIScriptAlias / {{ horizon_lib_wsgi_file }}
WSGIDaemonProcess horizon user={{ horizon_system_user_name }} group={{ horizon_system_group_name }} processes={{ horizon_wsgi_processes | default(wsgi_threads) }} threads={{ horizon_wsgi_threads | default(wsgi_threads) }}
WSGIDaemonProcess horizon user={{ horizon_system_user_name }} group={{ horizon_system_group_name }} processes={{ horizon_wsgi_processes | default(wsgi_threads) }} threads={{ horizon_wsgi_threads | default(wsgi_threads) }} {% if horizon_venv_enabled | bool %}python-path={{ horizon_venv_bin | dirname }}/lib/python2.7/site-packages{% endif %}
WSGIProcessGroup horizon
WSGIApplicationGroup horizon