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:
Logan V 2017-01-13 19:52:41 -06:00
parent 5b435ed12b
commit c7539bdc98
2 changed files with 9 additions and 13 deletions

View File

@ -51,6 +51,9 @@ horizon_developer_constraints:
horizon_venv_tag: untagged
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
## System info

View File

@ -81,7 +81,7 @@
dest: "/var/cache/{{ horizon_venv_download_url | basename }}"
checksum: "sha1:{{ lookup('url', horizon_venv_download_url | replace('tgz', 'checksum')) }}"
register: horizon_get_venv
when: not horizon_developer_mode | bool
when: horizon_venv_download | bool
- name: Remove existing venv
file:
@ -95,18 +95,14 @@
state: directory
mode: "0755"
register: horizon_venv_dir
when:
- not horizon_developer_mode | bool
- horizon_get_venv | changed
when: horizon_get_venv | changed
- name: Unarchive pre-built venv
unarchive:
src: "/var/cache/{{ horizon_venv_download_url | basename }}"
dest: "{{ horizon_bin | dirname }}"
copy: "no"
when:
- not horizon_developer_mode | bool
- horizon_get_venv | changed or horizon_venv_dir | changed
when: horizon_get_venv | changed
notify: Restart apache2
- name: Install pip packages
@ -123,7 +119,7 @@
until: install_packages|success
retries: 5
delay: 2
when: horizon_developer_mode | bool
when: horizon_get_venv | failed or horizon_get_venv | skipped
notify: Restart apache2
- name: Install optional pip packages
@ -148,15 +144,12 @@
state: "absent"
when:
- ansible_pkg_mgr == 'yum'
- not horizon_developer_mode | bool
- horizon_get_venv | changed or horizon_venv_dir | changed
- horizon_get_venv | changed
- name: Update virtualenv path
command: >
virtualenv-tools --update-path=auto --reinitialize {{ horizon_bin | dirname }}
when:
- not horizon_developer_mode | bool
- horizon_get_venv | changed or horizon_venv_dir | changed
when: horizon_get_venv | changed
- name: Create horizon link for venv
file: