Add python3 compatibility to horizon role

* Remove horizon_python_lib_dir, this is not used anywhere
* Autodetect the horizon_lib_dir for source installs
* Remove hardcoded python2.7 path from uwsgi template

Change-Id: I0747ad5c50c0c007385b4756f1b386363bafcf93
This commit is contained in:
Jonathan Rosser 2019-09-09 20:11:48 +01:00
parent c53c2eb574
commit 20e47c9e4b
6 changed files with 18 additions and 6 deletions

View File

@ -68,6 +68,18 @@
option: "venv_tag"
value: "{{ horizon_venv_tag }}"
- name: Find the venv's python version
find:
paths: "{{ horizon_bin | dirname }}/lib/"
patterns: "python*"
file_type: directory
recurse: no
register: _horizon_python_venv_details
- name: Set python lib dir fact
set_fact:
horizon_lib_dir: "{{ _horizon_python_venv_details.files[0].path }}/dist-packages"
- name: Create horizon link for venv
file:
src: "{{ horizon_lib_dir | dirname }}/site-packages"

View File

@ -40,7 +40,7 @@
{% endif %}
WSGIScriptAlias / {{ horizon_lib_wsgi_file }}
WSGIDaemonProcess horizon user={{ horizon_system_user_name }} group={{ horizon_system_group_name }} processes={{ horizon_wsgi_processes | default(horizon_wsgi_threads) }} threads={{ horizon_wsgi_threads }} python-path={{ horizon_bin | dirname }}/lib/python2.7/site-packages
WSGIDaemonProcess horizon user={{ horizon_system_user_name }} group={{ horizon_system_group_name }} processes={{ horizon_wsgi_processes | default(horizon_wsgi_threads) }} threads={{ horizon_wsgi_threads }} python-path={{ horizon_lib_dir | dirname }}/site-packages
WSGIProcessGroup horizon
WSGIApplicationGroup %{GLOBAL}

View File

@ -67,5 +67,4 @@ horizon_apache_modules:
state: "present"
_horizon_lib_dir: "/usr/share/openstack-dashboard"
horizon_python_lib_dir: "/usr/lib/python2.7/dist-packages"
horizon_dashboard_panel_dir: "{{ _horizon_lib_dir }}/openstack_dashboard/local/enabled"

View File

@ -58,5 +58,4 @@ horizon_apache_default_sites:
- "/etc/httpd/conf.d/ssl.conf"
_horizon_lib_dir: "/usr/share/openstack-dashboard"
horizon_python_lib_dir: "/usr/lib/python2.7/site-packages"
horizon_dashboard_panel_dir: "{{ _horizon_lib_dir }}/openstack_dashboard/local/enabled"

View File

@ -15,8 +15,11 @@
horizon_package_list: "{{ horizon_distro_packages }}"
_horizon_bin: "/openstack/venvs/horizon-{{ horizon_venv_tag }}/bin"
_horizon_lib_dir: "{{ _horizon_bin | dirname }}/lib/python2.7/dist-packages"
horizon_python_lib_dir: "{{ _horizon_lib_dir }}"
#NOTE(jrosser) for compatibility with py2 and py3 we detect the location of
#this dir during the source install and set a fact
#_horizon_lib_dir: "{{ _horizon_bin | dirname }}/lib/python2.7/dist-packages"
horizon_manage: "{{ _horizon_bin }}/horizon-manage.py"
horizon_dashboard_panel_dir: "{{ _horizon_lib_dir }}/openstack_dashboard/local/enabled"
_dashboard_panels_location:

View File

@ -77,5 +77,4 @@ horizon_apache_modules:
state: "present"
_horizon_lib_dir: "/srv/www/openstack-dashboard"
horizon_python_lib_dir: "/usr/lib/python2.7/site-packages"
horizon_dashboard_panel_dir: "{{ _horizon_lib_dir }}/openstack_dashboard/enabled"