Clean up developer mode logic
Fixes the ability to deploy a venv in cases where: 1) developer_mode is not enabled 2) A cached venv is not downloaded from the repo server Additional cleanup to the developer_mode venv deployment logic is implemented by adding a *_venv_download var which is used to decouple developer_mode from the cached venv extraction process so that a deployer can force venv builds in-place (disable cached venv usage) without enabling developer mode constraints. Change-Id: Iea13582d7344e343f60439500ef5e38dfbf1f1c1
This commit is contained in:
parent
5b435ed12b
commit
c7539bdc98
@ -51,6 +51,9 @@ horizon_developer_constraints:
|
|||||||
horizon_venv_tag: untagged
|
horizon_venv_tag: untagged
|
||||||
horizon_bin: "/openstack/venvs/horizon-{{ horizon_venv_tag }}/bin"
|
horizon_bin: "/openstack/venvs/horizon-{{ horizon_venv_tag }}/bin"
|
||||||
|
|
||||||
|
# venv_download, even when true, will use the fallback method of building the
|
||||||
|
# venv from scratch if the venv download fails.
|
||||||
|
horizon_venv_download: "{{ not horizon_developer_mode | bool }}"
|
||||||
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
|
||||||
|
|
||||||
## System info
|
## System info
|
||||||
|
@ -81,7 +81,7 @@
|
|||||||
dest: "/var/cache/{{ horizon_venv_download_url | basename }}"
|
dest: "/var/cache/{{ horizon_venv_download_url | basename }}"
|
||||||
checksum: "sha1:{{ lookup('url', horizon_venv_download_url | replace('tgz', 'checksum')) }}"
|
checksum: "sha1:{{ lookup('url', horizon_venv_download_url | replace('tgz', 'checksum')) }}"
|
||||||
register: horizon_get_venv
|
register: horizon_get_venv
|
||||||
when: not horizon_developer_mode | bool
|
when: horizon_venv_download | bool
|
||||||
|
|
||||||
- name: Remove existing venv
|
- name: Remove existing venv
|
||||||
file:
|
file:
|
||||||
@ -95,18 +95,14 @@
|
|||||||
state: directory
|
state: directory
|
||||||
mode: "0755"
|
mode: "0755"
|
||||||
register: horizon_venv_dir
|
register: horizon_venv_dir
|
||||||
when:
|
when: horizon_get_venv | changed
|
||||||
- not horizon_developer_mode | bool
|
|
||||||
- horizon_get_venv | changed
|
|
||||||
|
|
||||||
- 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_bin | dirname }}"
|
dest: "{{ horizon_bin | dirname }}"
|
||||||
copy: "no"
|
copy: "no"
|
||||||
when:
|
when: horizon_get_venv | changed
|
||||||
- not horizon_developer_mode | bool
|
|
||||||
- horizon_get_venv | changed or horizon_venv_dir | changed
|
|
||||||
notify: Restart apache2
|
notify: Restart apache2
|
||||||
|
|
||||||
- name: Install pip packages
|
- name: Install pip packages
|
||||||
@ -123,7 +119,7 @@
|
|||||||
until: install_packages|success
|
until: install_packages|success
|
||||||
retries: 5
|
retries: 5
|
||||||
delay: 2
|
delay: 2
|
||||||
when: horizon_developer_mode | bool
|
when: horizon_get_venv | failed or horizon_get_venv | skipped
|
||||||
notify: Restart apache2
|
notify: Restart apache2
|
||||||
|
|
||||||
- name: Install optional pip packages
|
- name: Install optional pip packages
|
||||||
@ -148,15 +144,12 @@
|
|||||||
state: "absent"
|
state: "absent"
|
||||||
when:
|
when:
|
||||||
- ansible_pkg_mgr == 'yum'
|
- ansible_pkg_mgr == 'yum'
|
||||||
- not horizon_developer_mode | bool
|
- horizon_get_venv | changed
|
||||||
- horizon_get_venv | changed or horizon_venv_dir | changed
|
|
||||||
|
|
||||||
- name: Update virtualenv path
|
- name: Update virtualenv path
|
||||||
command: >
|
command: >
|
||||||
virtualenv-tools --update-path=auto --reinitialize {{ horizon_bin | dirname }}
|
virtualenv-tools --update-path=auto --reinitialize {{ horizon_bin | dirname }}
|
||||||
when:
|
when: horizon_get_venv | changed
|
||||||
- not horizon_developer_mode | bool
|
|
||||||
- horizon_get_venv | changed or horizon_venv_dir | changed
|
|
||||||
|
|
||||||
- name: Create horizon link for venv
|
- name: Create horizon link for venv
|
||||||
file:
|
file:
|
||||||
|
Loading…
Reference in New Issue
Block a user