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: Id4e911dd28bf3e22fe5927b06464ee15c57f010e
This commit is contained in:
Logan V 2017-01-13 19:52:42 -06:00
parent 86f66c264c
commit 8aa416f385
2 changed files with 8 additions and 8 deletions

View File

@ -68,6 +68,9 @@ trove_profiler_enabled: false
trove_venv_tag: untagged trove_venv_tag: untagged
trove_bin: "/openstack/venvs/trove-{{ trove_venv_tag }}/bin" trove_bin: "/openstack/venvs/trove-{{ trove_venv_tag }}/bin"
# venv_download, even when true, will use the fallback method of building the
# venv from scratch if the venv download fails.
trove_venv_download: "{{ not trove_developer_mode | bool }}"
trove_venv_download_url: http://127.0.0.1/venvs/untagged/ubuntu/trove.tgz trove_venv_download_url: http://127.0.0.1/venvs/untagged/ubuntu/trove.tgz
trove_git_repo: "https://git.openstack.org/openstack/trove" trove_git_repo: "https://git.openstack.org/openstack/trove"

View File

@ -61,7 +61,7 @@
dest: "/var/cache/{{ trove_venv_download_url | basename }}" dest: "/var/cache/{{ trove_venv_download_url | basename }}"
checksum: "sha1:{{ lookup('url', trove_venv_download_url | replace('tgz', 'checksum')) }}" checksum: "sha1:{{ lookup('url', trove_venv_download_url | replace('tgz', 'checksum')) }}"
register: trove_get_venv register: trove_get_venv
when: not trove_developer_mode | bool when: trove_venv_download | bool
- name: Remove existing venv - name: Remove existing venv
file: file:
@ -75,15 +75,14 @@
state: directory state: directory
mode: "0755" mode: "0755"
register: trove_venv_dir register: trove_venv_dir
when: trove_get_venv | changed
- name: Unarchive pre-built venv - name: Unarchive pre-built venv
unarchive: unarchive:
src: "/var/cache/{{ trove_venv_download_url | basename }}" src: "/var/cache/{{ trove_venv_download_url | basename }}"
dest: "{{ trove_bin | dirname }}" dest: "{{ trove_bin | dirname }}"
copy: "no" copy: "no"
when: when: trove_get_venv | changed
- not trove_developer_mode | bool
- trove_get_venv | changed or trove_venv_dir | changed
notify: notify:
- Restart trove API services - Restart trove API services
- Restart trove conductor service - Restart trove conductor service
@ -104,7 +103,7 @@
until: install_packages|success until: install_packages|success
retries: 5 retries: 5
delay: 2 delay: 2
when: trove_developer_mode | bool when: trove_get_venv | failed or trove_get_venv | skipped
notify: notify:
- Restart trove API services - Restart trove API services
- Restart trove conductor service - Restart trove conductor service
@ -114,6 +113,4 @@
- name: Update virtualenv path - name: Update virtualenv path
command: > command: >
virtualenv-tools --update-path=auto --reinitialize {{ trove_bin | dirname }} virtualenv-tools --update-path=auto --reinitialize {{ trove_bin | dirname }}
when: when: trove_get_venv | changed
- not trove_developer_mode | bool
- trove_get_venv | changed or trove_venv_dir | changed