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: I6b0c6b4708b449e1961fce0e2b98389813844fc9
This commit is contained in:
Logan V 2017-01-13 19:52:42 -06:00
parent fef006ae46
commit d57237c8ae
2 changed files with 9 additions and 10 deletions

View File

@ -33,6 +33,9 @@ tempest_developer_constraints:
# Name of the virtual env to deploy into # Name of the virtual env to deploy into
tempest_venv_tag: untagged tempest_venv_tag: untagged
tempest_venv_bin: "/openstack/venvs/tempest-{{ tempest_venv_tag }}/bin" tempest_venv_bin: "/openstack/venvs/tempest-{{ tempest_venv_tag }}/bin"
# venv_download, even when true, will use the fallback method of building the
# venv from scratch if the venv download fails.
tempest_venv_download: "{{ not tempest_developer_mode | bool }}"
tempest_venv_download_url: http://127.0.0.1/venvs/untagged/ubuntu/tempest.tgz tempest_venv_download_url: http://127.0.0.1/venvs/untagged/ubuntu/tempest.tgz
# The location where the tempest logs will be placed # The location where the tempest logs will be placed

View File

@ -48,7 +48,7 @@
dest: "/var/cache/{{ tempest_venv_download_url | basename }}" dest: "/var/cache/{{ tempest_venv_download_url | basename }}"
checksum: "sha1:{{ lookup('url', tempest_venv_download_url | replace('tgz', 'checksum')) }}" checksum: "sha1:{{ lookup('url', tempest_venv_download_url | replace('tgz', 'checksum')) }}"
register: tempest_get_venv register: tempest_get_venv
when: not tempest_developer_mode | bool when: tempest_venv_download | bool
- name: Remove existing venv - name: Remove existing venv
file: file:
@ -82,15 +82,14 @@
state: directory state: directory
mode: "0755" mode: "0755"
register: tempest_venv_dir register: tempest_venv_dir
when: tempest_get_venv | changed
- name: Unarchive pre-built venv - name: Unarchive pre-built venv
unarchive: unarchive:
src: "/var/cache/{{ tempest_venv_download_url | basename }}" src: "/var/cache/{{ tempest_venv_download_url | basename }}"
dest: "{{ tempest_venv_bin | dirname }}" dest: "{{ tempest_venv_bin | dirname }}"
copy: "no" copy: "no"
when: when: tempest_get_venv | changed
- not tempest_developer_mode | bool
- tempest_get_venv | changed or tempest_venv_dir | changed
- name: Install pip packages - name: Install pip packages
pip: pip:
@ -106,7 +105,7 @@
until: install_packages|success until: install_packages|success
retries: 5 retries: 5
delay: 2 delay: 2
when: tempest_developer_mode | bool when: tempest_get_venv | failed or tempest_get_venv | skipped
- name: CentOS remove python from path first - name: CentOS remove python from path first
file: file:
@ -114,15 +113,12 @@
state: "absent" state: "absent"
when: when:
- ansible_pkg_mgr == 'yum' - ansible_pkg_mgr == 'yum'
- not tempest_developer_mode | bool - tempest_get_venv | changed
- tempest_get_venv | changed or tempest_venv_dir | changed
- name: Update virtualenv path - name: Update virtualenv path
command: > command: >
virtualenv-tools --update-path=auto --reinitialize {{ tempest_venv_bin | dirname }} virtualenv-tools --update-path=auto --reinitialize {{ tempest_venv_bin | dirname }}
when: when: tempest_get_venv | changed
- not tempest_developer_mode | bool
- tempest_get_venv | changed or tempest_venv_dir | changed
- name: Get tempest plugins from git - name: Get tempest plugins from git
git: git: