Only install to virtual environment
Remove all tasks and variables related to toggling between installation of horizon inside or outside of a Python virtual environment. Installing within a venv is now the only supported deployment. Additionally, a few changes have been made to make the creation of the venv more resistant to interruptions during a run of the role. * unarchiving a pre-built venv will now also occur when the venv directory is created, not only after being downloaded * virtualenv-tools is run against both pre-built and non pre-built venvs to account for interruptions during or prior to unarchiving Change-Id: I8f5d33b90cc2c41beca2067f0f99d8c1283021e4 Implements: blueprint only-install-venvs
This commit is contained in:
parent
5617c4de57
commit
4559edf920
@ -26,15 +26,7 @@ horizon_developer_constraints:
|
|||||||
|
|
||||||
# Name of the virtual env to deploy into
|
# Name of the virtual env to deploy into
|
||||||
horizon_venv_tag: untagged
|
horizon_venv_tag: untagged
|
||||||
horizon_venv_bin: "/openstack/venvs/horizon-{{ horizon_venv_tag }}/bin"
|
horizon_bin: "/openstack/venvs/horizon-{{ horizon_venv_tag }}/bin"
|
||||||
|
|
||||||
# Set this to enable or disable installing in a venv
|
|
||||||
horizon_venv_enabled: true
|
|
||||||
|
|
||||||
# The bin path defaults to the venv path however if installation in a
|
|
||||||
# venv is disabled the bin path will be dynamically set based on the
|
|
||||||
# system path used when the installing.
|
|
||||||
horizon_bin: "{{ horizon_venv_bin }}"
|
|
||||||
|
|
||||||
horizon_venv_download_url: http://127.0.0.1/venvs/untagged/ubuntu/horizon.tgz
|
horizon_venv_download_url: http://127.0.0.1/venvs/untagged/ubuntu/horizon.tgz
|
||||||
|
|
||||||
@ -62,9 +54,7 @@ horizon_session_timeout: 1800
|
|||||||
horizon_help_url: http://docs.openstack.org
|
horizon_help_url: http://docs.openstack.org
|
||||||
|
|
||||||
## Installation directories
|
## Installation directories
|
||||||
horizon_venv_lib_dir: "{{ horizon_bin | dirname }}/lib/python2.7/dist-packages"
|
horizon_lib_dir: "{{ horizon_bin | dirname }}/lib/python2.7/dist-packages"
|
||||||
horizon_non_venv_lib_dir: "/usr/local/lib/python2.7/dist-packages"
|
|
||||||
horizon_lib_dir: "{{ (horizon_venv_enabled | bool) | ternary(horizon_venv_lib_dir, horizon_non_venv_lib_dir) }}"
|
|
||||||
horizon_lib_wsgi_file: "{{ horizon_lib_dir }}/openstack_dashboard/wsgi/django.wsgi"
|
horizon_lib_wsgi_file: "{{ horizon_lib_dir }}/openstack_dashboard/wsgi/django.wsgi"
|
||||||
|
|
||||||
horizon_endpoint_type: internalURL
|
horizon_endpoint_type: internalURL
|
||||||
|
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
upgrade:
|
||||||
|
- Installation of horizon and its dependent pip packages will now only
|
||||||
|
occur within a Python virtual environment. The ``horizon_venv_bin``,
|
||||||
|
``horizon_venv_enabled``, ``horizon_venv_lib_dir``, and
|
||||||
|
``horizon_non_venv_lib_dir`` variables have been removed.
|
@ -82,7 +82,6 @@
|
|||||||
get_md5: False
|
get_md5: False
|
||||||
when:
|
when:
|
||||||
- not horizon_developer_mode | bool
|
- not horizon_developer_mode | bool
|
||||||
- horizon_venv_enabled | bool
|
|
||||||
register: local_venv_stat
|
register: local_venv_stat
|
||||||
tags:
|
tags:
|
||||||
- horizon-install
|
- horizon-install
|
||||||
@ -94,7 +93,6 @@
|
|||||||
return_content: True
|
return_content: True
|
||||||
when:
|
when:
|
||||||
- not horizon_developer_mode | bool
|
- not horizon_developer_mode | bool
|
||||||
- horizon_venv_enabled | bool
|
|
||||||
register: remote_venv_checksum
|
register: remote_venv_checksum
|
||||||
tags:
|
tags:
|
||||||
- horizon-install
|
- horizon-install
|
||||||
@ -114,7 +112,6 @@
|
|||||||
register: get_venv
|
register: get_venv
|
||||||
when:
|
when:
|
||||||
- not horizon_developer_mode | bool
|
- not horizon_developer_mode | bool
|
||||||
- horizon_venv_enabled | bool
|
|
||||||
- (local_venv_stat.stat.exists == False or
|
- (local_venv_stat.stat.exists == False or
|
||||||
{{ local_venv_stat.stat.checksum is defined and local_venv_stat.stat.checksum != remote_venv_checksum.content | trim }})
|
{{ local_venv_stat.stat.checksum is defined and local_venv_stat.stat.checksum != remote_venv_checksum.content | trim }})
|
||||||
tags:
|
tags:
|
||||||
@ -124,17 +121,15 @@
|
|||||||
- name: Set horizon get_venv fact
|
- name: Set horizon get_venv fact
|
||||||
set_fact:
|
set_fact:
|
||||||
horizon_get_venv: "{{ get_venv }}"
|
horizon_get_venv: "{{ get_venv }}"
|
||||||
when: horizon_venv_enabled | bool
|
|
||||||
tags:
|
tags:
|
||||||
- horizon-install
|
- horizon-install
|
||||||
- horizon-pip-packages
|
- horizon-pip-packages
|
||||||
|
|
||||||
- name: Remove existing venv
|
- name: Remove existing venv
|
||||||
file:
|
file:
|
||||||
path: "{{ horizon_venv_bin | dirname }}"
|
path: "{{ horizon_bin | dirname }}"
|
||||||
state: absent
|
state: absent
|
||||||
when:
|
when:
|
||||||
- horizon_venv_enabled | bool
|
|
||||||
- horizon_get_venv | changed
|
- horizon_get_venv | changed
|
||||||
tags:
|
tags:
|
||||||
- horizon-install
|
- horizon-install
|
||||||
@ -142,11 +137,11 @@
|
|||||||
|
|
||||||
- name: Create horizon venv dir
|
- name: Create horizon venv dir
|
||||||
file:
|
file:
|
||||||
path: "{{ horizon_venv_bin | dirname }}"
|
path: "{{ horizon_bin | dirname }}"
|
||||||
state: directory
|
state: directory
|
||||||
|
register: horizon_venv_dir
|
||||||
when:
|
when:
|
||||||
- not horizon_developer_mode | bool
|
- not horizon_developer_mode | bool
|
||||||
- horizon_venv_enabled | bool
|
|
||||||
- horizon_get_venv | changed
|
- horizon_get_venv | changed
|
||||||
tags:
|
tags:
|
||||||
- horizon-install
|
- horizon-install
|
||||||
@ -155,33 +150,21 @@
|
|||||||
- name: Unarchive pre-built venv
|
- name: Unarchive pre-built venv
|
||||||
unarchive:
|
unarchive:
|
||||||
src: "/var/cache/{{ horizon_venv_download_url | basename }}"
|
src: "/var/cache/{{ horizon_venv_download_url | basename }}"
|
||||||
dest: "{{ horizon_venv_bin | dirname }}"
|
dest: "{{ horizon_bin | dirname }}"
|
||||||
copy: "no"
|
copy: "no"
|
||||||
when:
|
when:
|
||||||
- not horizon_developer_mode | bool
|
- not horizon_developer_mode | bool
|
||||||
- horizon_venv_enabled | bool
|
- horizon_get_venv | changed or horizon_venv_dir | changed
|
||||||
- horizon_get_venv | changed
|
|
||||||
notify: Restart apache2
|
notify: Restart apache2
|
||||||
tags:
|
tags:
|
||||||
- horizon-install
|
- horizon-install
|
||||||
- horizon-pip-packages
|
- horizon-pip-packages
|
||||||
|
|
||||||
- name: Update virtualenv path
|
- name: Install pip packages
|
||||||
command: >
|
|
||||||
virtualenv-tools --update-path=auto {{ horizon_venv_bin | dirname }}
|
|
||||||
when:
|
|
||||||
- not horizon_developer_mode | bool
|
|
||||||
- horizon_venv_enabled | bool
|
|
||||||
- horizon_get_venv | success
|
|
||||||
tags:
|
|
||||||
- horizon-install
|
|
||||||
- horizon-pip-packages
|
|
||||||
|
|
||||||
- name: Install pip packages (venv)
|
|
||||||
pip:
|
pip:
|
||||||
name: "{{ item }}"
|
name: "{{ item }}"
|
||||||
state: latest
|
state: latest
|
||||||
virtualenv: "{{ horizon_venv_bin | dirname }}"
|
virtualenv: "{{ horizon_bin | dirname }}"
|
||||||
virtualenv_site_packages: "no"
|
virtualenv_site_packages: "no"
|
||||||
extra_args: "{{ pip_install_options_fact }}"
|
extra_args: "{{ pip_install_options_fact }}"
|
||||||
register: install_packages
|
register: install_packages
|
||||||
@ -190,41 +173,28 @@
|
|||||||
delay: 2
|
delay: 2
|
||||||
with_items: "{{ horizon_pip_packages }}"
|
with_items: "{{ horizon_pip_packages }}"
|
||||||
when:
|
when:
|
||||||
- horizon_venv_enabled | bool
|
|
||||||
- horizon_get_venv | failed or horizon_developer_mode | bool
|
- horizon_get_venv | failed or horizon_developer_mode | bool
|
||||||
notify: Restart apache2
|
notify: Restart apache2
|
||||||
tags:
|
tags:
|
||||||
- horizon-pip-packages
|
- horizon-pip-packages
|
||||||
|
|
||||||
- name: Install pip packages (no venv)
|
- name: Update virtualenv path
|
||||||
pip:
|
command: >
|
||||||
name: "{{ item }}"
|
virtualenv-tools --update-path=auto {{ horizon_bin | dirname }}
|
||||||
state: latest
|
|
||||||
extra_args: "{{ pip_install_options_fact }}"
|
|
||||||
register: install_packages
|
|
||||||
until: install_packages|success
|
|
||||||
retries: 5
|
|
||||||
delay: 2
|
|
||||||
with_items: "{{ horizon_pip_packages }}"
|
|
||||||
when:
|
when:
|
||||||
- not horizon_developer_mode | bool
|
- not horizon_developer_mode | bool
|
||||||
- not horizon_venv_enabled | bool
|
- horizon_get_venv | success
|
||||||
notify: Restart apache2
|
|
||||||
tags:
|
tags:
|
||||||
|
- horizon-install
|
||||||
- horizon-pip-packages
|
- horizon-pip-packages
|
||||||
|
|
||||||
- name: Create horizon links for venv
|
- name: Create horizon link for venv
|
||||||
file:
|
file:
|
||||||
src: "{{ item.src }}"
|
src: "{{ horizon_lib_dir | dirname }}/site-packages"
|
||||||
dest: "{{ item.dest }}"
|
dest: "{{ horizon_lib_dir }}"
|
||||||
owner: "{{ horizon_system_user_name }}"
|
owner: "{{ horizon_system_user_name }}"
|
||||||
group: "{{ horizon_system_group_name }}"
|
group: "{{ horizon_system_group_name }}"
|
||||||
state: "link"
|
state: "link"
|
||||||
with_items:
|
|
||||||
- src: "{{ horizon_lib_dir | dirname }}/site-packages"
|
|
||||||
dest: "{{ horizon_lib_dir }}"
|
|
||||||
when:
|
|
||||||
- horizon_venv_enabled | bool
|
|
||||||
tags:
|
tags:
|
||||||
- horizon-install
|
- horizon-install
|
||||||
- horizon-configs
|
- horizon-configs
|
||||||
|
@ -13,25 +13,6 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
# Because there is no specific "horizon" command this method
|
|
||||||
# is looking for the "keystone" command to set the horizon
|
|
||||||
# command path.
|
|
||||||
- name: Get horizon command path
|
|
||||||
command: which keystone
|
|
||||||
register: horizon_command_path
|
|
||||||
when:
|
|
||||||
- not horizon_venv_enabled | bool
|
|
||||||
tags:
|
|
||||||
- horizon-command-bin
|
|
||||||
|
|
||||||
- name: Set horizon command path
|
|
||||||
set_fact:
|
|
||||||
horizon_bin: "{{ horizon_command_path.stdout | dirname }}"
|
|
||||||
when:
|
|
||||||
- not horizon_venv_enabled | bool
|
|
||||||
tags:
|
|
||||||
- horizon-command-bin
|
|
||||||
|
|
||||||
- name: Setup Horizon config(s)
|
- name: Setup Horizon config(s)
|
||||||
template:
|
template:
|
||||||
src: "{{ item.src }}"
|
src: "{{ item.src }}"
|
||||||
@ -58,8 +39,8 @@
|
|||||||
|
|
||||||
- name: Enable the neutron-lbaas-dashboard Horizon panel
|
- name: Enable the neutron-lbaas-dashboard Horizon panel
|
||||||
file:
|
file:
|
||||||
src: "{{ horizon_venv_lib_dir }}/neutron_lbaas_dashboard/enabled/_1481_project_ng_loadbalancersv2_panel.py"
|
src: "{{ horizon_lib_dir }}/neutron_lbaas_dashboard/enabled/_1481_project_ng_loadbalancersv2_panel.py"
|
||||||
path: "{{ horizon_venv_lib_dir }}/openstack_dashboard/local/enabled/_1481_project_ng_loadbalancersv2_panel.py"
|
path: "{{ horizon_lib_dir }}/openstack_dashboard/local/enabled/_1481_project_ng_loadbalancersv2_panel.py"
|
||||||
state: "{{ (horizon_enable_neutron_lbaas | bool) | ternary('link', 'absent') }}"
|
state: "{{ (horizon_enable_neutron_lbaas | bool) | ternary('link', 'absent') }}"
|
||||||
notify: Restart apache2
|
notify: Restart apache2
|
||||||
tags:
|
tags:
|
||||||
|
@ -46,18 +46,6 @@
|
|||||||
tags:
|
tags:
|
||||||
- horizon-dirs
|
- horizon-dirs
|
||||||
|
|
||||||
- name: Create horizon venv dir
|
|
||||||
file:
|
|
||||||
path: "{{ item.path }}"
|
|
||||||
state: directory
|
|
||||||
with_items:
|
|
||||||
- { path: "/openstack/venvs" }
|
|
||||||
- { path: "{{ horizon_venv_bin }}" }
|
|
||||||
when:
|
|
||||||
- horizon_venv_enabled | bool
|
|
||||||
tags:
|
|
||||||
- horizon-dirs
|
|
||||||
|
|
||||||
- name: Test for log directory or link
|
- name: Test for log directory or link
|
||||||
shell: |
|
shell: |
|
||||||
if [ -h "/var/log/horizon" ]; then
|
if [ -h "/var/log/horizon" ]; then
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!{{ horizon_venv_enabled | bool | ternary(horizon_venv_bin + "/", "/usr/bin/env ") }}python
|
#!{{ horizon_bin }}/python
|
||||||
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
# 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
|
# not use this file except in compliance with the License. You may obtain
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
WSGIScriptAlias / {{ horizon_lib_wsgi_file }}
|
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) }} {% if horizon_venv_enabled | bool %}python-path={{ horizon_venv_bin | dirname }}/lib/python2.7/site-packages{% endif %}
|
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) }} python-path={{ horizon_bin | dirname }}/lib/python2.7/site-packages
|
||||||
|
|
||||||
WSGIProcessGroup horizon
|
WSGIProcessGroup horizon
|
||||||
WSGIApplicationGroup horizon
|
WSGIApplicationGroup horizon
|
||||||
|
@ -20,8 +20,8 @@
|
|||||||
tasks:
|
tasks:
|
||||||
- name: Run tempest
|
- name: Run tempest
|
||||||
shell: |
|
shell: |
|
||||||
. {{ tempest_venv_bin }}/activate
|
. {{ tempest_bin }}/activate
|
||||||
{{ tempest_venv_bin | dirname }}/run_tempest.sh --no-virtual-env ${RUN_TEMPEST_OPTS} tempest_horizon.tests.scenario.test_dashboard_basic_ops.TestDashboardBasicOps
|
{{ tempest_bin | dirname }}/run_tempest.sh --no-virtual-env ${RUN_TEMPEST_OPTS} tempest_horizon.tests.scenario.test_dashboard_basic_ops.TestDashboardBasicOps
|
||||||
environment:
|
environment:
|
||||||
RUN_TEMPEST_OPTS: "--serial"
|
RUN_TEMPEST_OPTS: "--serial"
|
||||||
vars_files:
|
vars_files:
|
||||||
|
@ -66,9 +66,9 @@ tempest_dashboard_url: "https://10.100.100.4/"
|
|||||||
tempest_developer_mode: True
|
tempest_developer_mode: True
|
||||||
tempest_git_install_branch: master
|
tempest_git_install_branch: master
|
||||||
tempest_venv_tag: "{{ tempest_git_install_branch }}"
|
tempest_venv_tag: "{{ tempest_git_install_branch }}"
|
||||||
# tempest_venv_bin is the same as the default in os_tempest role, but we set
|
# tempest_bin is the same as the default in os_tempest role, but we set
|
||||||
# it again here so we can refer to it in test-horizon-functional.yml
|
# it again here so we can refer to it in test-horizon-functional.yml
|
||||||
tempest_venv_bin: "/opt/tempest_{{ tempest_venv_tag }}/bin"
|
tempest_bin: "/opt/tempest_{{ tempest_venv_tag }}/bin"
|
||||||
tempest_log_dir: "/var/log/"
|
tempest_log_dir: "/var/log/"
|
||||||
tempest_main_group: horizon_all
|
tempest_main_group: horizon_all
|
||||||
tempest_service_available_aodh: False
|
tempest_service_available_aodh: False
|
||||||
|
Loading…
Reference in New Issue
Block a user