Only install to virtual environment
Remove all tasks and variables related to toggling between installation of heat 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: I5cd25a53b75c1ee1a7c215d5912db4f02fa4225c Implements: blueprint only-install-venvs
This commit is contained in:
parent
ba9c72a1dc
commit
7b3cca8aea
@ -32,15 +32,7 @@ heat_developer_constraints:
|
||||
|
||||
# Name of the virtual env to deploy into
|
||||
heat_venv_tag: untagged
|
||||
heat_venv_bin: "/openstack/venvs/heat-{{ heat_venv_tag }}/bin"
|
||||
|
||||
# Set this to enable or disable installing in a venv
|
||||
heat_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.
|
||||
heat_bin: "{{ heat_venv_bin }}"
|
||||
heat_bin: "/openstack/venvs/heat-{{ heat_venv_tag }}/bin"
|
||||
|
||||
heat_venv_download_url: http://127.0.0.1/venvs/untagged/ubuntu/heat.tgz
|
||||
|
||||
|
@ -0,0 +1,5 @@
|
||||
---
|
||||
upgrade:
|
||||
- Installation of heat and its dependent pip packages will now only
|
||||
occur within a Python virtual environment. The ``heat_venv_bin``
|
||||
and ``heat_venv_enabled`` variables have been removed.
|
@ -83,7 +83,6 @@
|
||||
get_md5: False
|
||||
when:
|
||||
- not heat_developer_mode | bool
|
||||
- heat_venv_enabled | bool
|
||||
register: local_venv_stat
|
||||
tags:
|
||||
- heat-install
|
||||
@ -95,7 +94,6 @@
|
||||
return_content: True
|
||||
when:
|
||||
- not heat_developer_mode | bool
|
||||
- heat_venv_enabled | bool
|
||||
register: remote_venv_checksum
|
||||
tags:
|
||||
- heat-install
|
||||
@ -115,7 +113,6 @@
|
||||
register: get_venv
|
||||
when:
|
||||
- not heat_developer_mode | bool
|
||||
- heat_venv_enabled | bool
|
||||
- (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 }})
|
||||
tags:
|
||||
@ -125,17 +122,15 @@
|
||||
- name: Set heat get_venv fact
|
||||
set_fact:
|
||||
heat_get_venv: "{{ get_venv }}"
|
||||
when: heat_venv_enabled | bool
|
||||
tags:
|
||||
- heat-install
|
||||
- heat-pip-packages
|
||||
|
||||
- name: Remove existing venv
|
||||
file:
|
||||
path: "{{ heat_venv_bin | dirname }}"
|
||||
path: "{{ heat_bin | dirname }}"
|
||||
state: absent
|
||||
when:
|
||||
- heat_venv_enabled | bool
|
||||
- heat_get_venv | changed
|
||||
tags:
|
||||
- heat-install
|
||||
@ -143,12 +138,9 @@
|
||||
|
||||
- name: Create heat venv dir
|
||||
file:
|
||||
path: "{{ heat_venv_bin | dirname }}"
|
||||
path: "{{ heat_bin | dirname }}"
|
||||
state: directory
|
||||
when:
|
||||
- not heat_developer_mode | bool
|
||||
- heat_venv_enabled | bool
|
||||
- heat_get_venv | changed
|
||||
register: heat_venv_dir
|
||||
tags:
|
||||
- heat-install
|
||||
- heat-pip-packages
|
||||
@ -156,33 +148,21 @@
|
||||
- name: Unarchive pre-built venv
|
||||
unarchive:
|
||||
src: "/var/cache/{{ heat_venv_download_url | basename }}"
|
||||
dest: "{{ heat_venv_bin | dirname }}"
|
||||
dest: "{{ heat_bin | dirname }}"
|
||||
copy: "no"
|
||||
when:
|
||||
- not heat_developer_mode | bool
|
||||
- heat_venv_enabled | bool
|
||||
- heat_get_venv | changed
|
||||
- heat_get_venv | changed or heat_venv_dir | changed
|
||||
notify: Restart heat services
|
||||
tags:
|
||||
- heat-install
|
||||
- heat-pip-packages
|
||||
|
||||
- name: Update virtualenv path
|
||||
command: >
|
||||
virtualenv-tools --update-path=auto {{ heat_venv_bin | dirname }}
|
||||
when:
|
||||
- not heat_developer_mode | bool
|
||||
- heat_venv_enabled | bool
|
||||
- heat_get_venv | success
|
||||
tags:
|
||||
- heat-install
|
||||
- heat-pip-packages
|
||||
|
||||
- name: Install pip packages (venv)
|
||||
- name: Install pip packages
|
||||
pip:
|
||||
name: "{{ item }}"
|
||||
state: latest
|
||||
virtualenv: "{{ heat_venv_bin | dirname }}"
|
||||
virtualenv: "{{ heat_bin | dirname }}"
|
||||
virtualenv_site_packages: "no"
|
||||
extra_args: "{{ pip_install_options_fact }}"
|
||||
register: install_packages
|
||||
@ -191,27 +171,19 @@
|
||||
delay: 2
|
||||
with_items: "{{ heat_pip_packages }}"
|
||||
when:
|
||||
- heat_venv_enabled | bool
|
||||
- heat_get_venv | failed or heat_developer_mode | bool
|
||||
notify: Restart heat services
|
||||
tags:
|
||||
- heat-install
|
||||
- heat-pip-packages
|
||||
|
||||
- name: Install pip packages (no venv)
|
||||
pip:
|
||||
name: "{{ item }}"
|
||||
state: latest
|
||||
extra_args: "{{ pip_install_options_fact }}"
|
||||
register: install_packages
|
||||
until: install_packages|success
|
||||
retries: 5
|
||||
delay: 2
|
||||
with_items: "{{ heat_pip_packages }}"
|
||||
- name: Update virtualenv path
|
||||
command: >
|
||||
virtualenv-tools --update-path=auto {{ heat_bin | dirname }}
|
||||
when:
|
||||
- not heat_developer_mode | bool
|
||||
- not heat_venv_enabled | bool
|
||||
notify: Restart heat services
|
||||
- heat_get_venv | success
|
||||
tags:
|
||||
- heat-install
|
||||
- heat-pip-packages
|
||||
|
||||
|
@ -51,19 +51,3 @@
|
||||
- Restart heat services
|
||||
tags:
|
||||
- heat-config
|
||||
|
||||
- name: Get heat command path
|
||||
command: which heat
|
||||
register: heat_command_path
|
||||
when:
|
||||
- not heat_venv_enabled | bool
|
||||
tags:
|
||||
- heat-command-bin
|
||||
|
||||
- name: Set heat command path
|
||||
set_fact:
|
||||
heat_bin: "{{ heat_command_path.stdout | dirname }}"
|
||||
when:
|
||||
- not heat_venv_enabled | bool
|
||||
tags:
|
||||
- heat-command-bin
|
||||
|
@ -50,17 +50,6 @@
|
||||
tags:
|
||||
- heat-dirs
|
||||
|
||||
- name: Create heat venv dir
|
||||
file:
|
||||
path: "{{ item.path }}"
|
||||
state: directory
|
||||
with_items:
|
||||
- { path: "/openstack/venvs" }
|
||||
- { path: "{{ heat_venv_bin }}" }
|
||||
when: heat_venv_enabled | bool
|
||||
tags:
|
||||
- heat-dirs
|
||||
|
||||
- name: Create heat plugin dirs
|
||||
file:
|
||||
path: "{{ item }}"
|
||||
|
@ -23,9 +23,7 @@ pre-start script
|
||||
mkdir -p "/var/lock/{{ program_name }}"
|
||||
chown {{ system_user }}:{{ system_group }} "/var/lock/{{ program_name }}"
|
||||
|
||||
{% if heat_venv_enabled | bool -%}
|
||||
. {{ heat_venv_bin }}/activate
|
||||
{%- endif %}
|
||||
. {{ heat_bin }}/activate
|
||||
|
||||
end script
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user