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: I7ac0d8e732f0e97bf667e4428238acc2dc8bee0b
This commit is contained in:
Logan V 2017-01-13 19:52:41 -06:00
parent 82981157c9
commit 8da3c30111
2 changed files with 9 additions and 13 deletions

View File

@ -36,6 +36,9 @@ aodh_developer_constraints:
aodh_venv_tag: untagged
aodh_bin: "/openstack/venvs/aodh-{{ aodh_venv_tag }}/bin"
# venv_download, even when true, will use the fallback method of building the
# venv from scratch if the venv download fails.
aodh_venv_download: "{{ not aodh_developer_mode | bool }}"
# URL of the pre-built virtualenv
aodh_venv_download_url: http://127.0.0.1/venvs/untagged/ubuntu/aodh.tgz

View File

@ -68,7 +68,7 @@
dest: "/var/cache/{{ aodh_venv_download_url | basename }}"
checksum: "sha1:{{ lookup('url', aodh_venv_download_url | replace('tgz', 'checksum')) }}"
register: aodh_get_venv
when: not aodh_developer_mode | bool
when: aodh_venv_download | bool
- name: Remove existing venv
file:
@ -82,18 +82,14 @@
state: directory
mode: "0755"
register: aodh_venv_dir
when:
- not aodh_developer_mode | bool
- aodh_get_venv | changed
when: aodh_get_venv | changed
- name: Unarchive pre-built venv
unarchive:
src: "/var/cache/{{ aodh_venv_download_url | basename }}"
dest: "{{ aodh_bin | dirname }}"
copy: "no"
when:
- not aodh_developer_mode | bool
- aodh_get_venv | changed or aodh_venv_dir | changed
when: aodh_get_venv | changed
notify: Restart aodh services
- name: Install pip packages
@ -110,7 +106,7 @@
until: install_packages|success
retries: 5
delay: 2
when: aodh_developer_mode | bool
when: aodh_get_venv | failed or aodh_get_venv | skipped
notify: Restart aodh services
- name: CentOS remove python from path first
@ -119,12 +115,9 @@
state: "absent"
when:
- ansible_pkg_mgr == 'yum'
- not aodh_developer_mode | bool
- aodh_get_venv | changed or aodh_venv_dir | changed
- aodh_get_venv | changed
- name: Update virtualenv path
command: >
virtualenv-tools --update-path=auto --reinitialize {{ aodh_bin | dirname }}
when:
- not aodh_developer_mode | bool
- aodh_get_venv | changed or aodh_venv_dir | changed
when: aodh_get_venv | changed