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: I0280dce05e9f20b035e64b85750c72895e83a4b7
This commit is contained in:
Logan V 2017-01-13 19:52:41 -06:00 committed by Donovan Francesco (drifterza)
parent 44111f49f1
commit c2f3c075af
2 changed files with 8 additions and 8 deletions

View File

@ -51,6 +51,9 @@ monasca_service_adminurl: "{{ monasca_service_adminuri_proto }}://{{ internal_lb
# Name of the virtual env to deploy into
monasca_venv_tag: untagged
# venv_download, even when true, will use the fallback method of building the
# venv from scratch if the venv download fails.
monasca_venv_download: "{{ not monasca_developer_mode | bool }}"
monasca_venv_download_url: http://127.0.0.1/venvs/untagged/ubuntu/monasca.tgz
monasca_bin: "/openstack/venvs/monasca-{{ monasca_venv_tag }}/bin"

View File

@ -47,7 +47,7 @@
dest: "/var/cache/{{ monasca_venv_download_url | basename }}"
checksum: "sha1:{{ lookup('url', monasca_venv_download_url | replace('tgz', 'checksum')) }}"
register: monasca_get_venv
when: not monasca_developer_mode | bool
when: monasca_venv_download | bool
- name: Remove existing venv
file:
@ -60,15 +60,14 @@
path: "{{ monasca_bin | dirname }}"
state: directory
register: monasca_venv_dir
when: monasca_get_venv | changed
- name: Unarchive pre-built venv
unarchive:
src: "/var/cache/{{ monasca_venv_download_url | basename }}"
dest: "{{ monasca_bin | dirname }}"
copy: "no"
when:
- not monasca_developer_mode | bool
- monasca_get_venv | changed or monasca_venv_dir | changed
when: monasca_get_venv | changed
notify:
- Restart monasca services
@ -86,12 +85,10 @@
until: install_packages|success
retries: 5
delay: 2
when: monasca_developer_mode | bool
when: monasca_get_venv | failed or monasca_get_venv | skipped
notify: Restart monasca services
- name: Update virtualenv path
command: >
virtualenv-tools --update-path=auto --reinitialize {{ monasca_bin | dirname }}
when:
- not monasca_developer_mode | bool
- monasca_get_venv | changed or monasca_venv_dir | changed
when: monasca_get_venv | changed