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: I6939e47455898c07003f1b480e6d65b5d06e4c68
This commit is contained in:
Logan V 2017-01-13 19:52:42 -06:00 committed by Andy McCrae
parent 4b451fc394
commit c295b18a79
2 changed files with 9 additions and 11 deletions

View File

@ -36,6 +36,9 @@ rally_developer_constraints:
rally_venv_tag: untagged
rally_bin: "/openstack/venvs/rally-{{ rally_venv_tag }}/bin"
# venv_download, even when true, will use the fallback method of building the
# venv from scratch if the venv download fails.
rally_venv_download: "{{ not rally_developer_mode | bool }}"
rally_venv_download_url: http://127.0.0.1/venvs/untagged/ubuntu/rally.tgz
# Database vars

View File

@ -44,7 +44,7 @@
dest: "/var/cache/{{ rally_venv_download_url | basename }}"
checksum: "sha1:{{ lookup('url', rally_venv_download_url | replace('tgz', 'checksum')) }}"
register: rally_get_venv
when: not rally_developer_mode | bool
when: rally_venv_download | bool
- name: Remove existing venv
file:
@ -56,16 +56,14 @@
file:
path: "{{ rally_bin | dirname }}"
state: directory
register: rally_venv_dir
when: rally_get_venv | changed
- name: Unarchive pre-built venv
unarchive:
src: "/var/cache/{{ rally_venv_download_url | basename }}"
dest: "{{ rally_bin | dirname }}"
copy: "no"
when:
- not rally_developer_mode | bool
- rally_get_venv | changed or rally_venv_dir | changed
when: rally_get_venv | changed
- name: Install pip packages
pip:
@ -81,7 +79,7 @@
until: install_packages|success
retries: 5
delay: 2
when: rally_developer_mode | bool
when: rally_get_venv | failed or rally_get_venv | skipped
- name: CentOS remove python from path first
file:
@ -89,12 +87,9 @@
state: "absent"
when:
- ansible_pkg_mgr == 'yum'
- not rally_developer_mode | bool
- rally_get_venv | changed or rally_venv_dir | changed
- rally_get_venv | changed
- name: Update virtualenv path
command: >
virtualenv-tools --update-path=auto --reinitialize {{ rally_bin | dirname }}
when:
- not rally_developer_mode | bool
- rally_get_venv | changed or rally_venv_dir | changed
when: rally_get_venv | changed