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: I41b64f47a9a59c8dfb0818be147b5f7c2ce171df
This commit is contained in:
Logan V 2017-01-13 19:52:41 -06:00
parent 40baa9fe7e
commit ee0665f4a1
2 changed files with 8 additions and 10 deletions

View File

@ -82,6 +82,9 @@ barbican_developer_constraints:
barbican_venv_tag: untagged
barbican_bin: "/openstack/venvs/barbican-{{ barbican_venv_tag }}/bin"
# venv_download, even when true, will use the fallback method of building the
# venv from scratch if the venv download fails.
barbican_venv_download: "{{ not barbican_developer_mode | bool }}"
# URL of the pre-built virtualenv
barbican_venv_download_url: http://127.0.0.1/venvs/untagged/ubuntu/barbican.tgz

View File

@ -45,7 +45,7 @@
dest: "/var/cache/{{ barbican_venv_download_url | basename }}"
checksum: "sha1:{{ lookup('url', barbican_venv_download_url | replace('tgz', 'checksum')) }}"
register: barbican_get_venv
when: not barbican_developer_mode | bool
when: barbican_venv_download | bool
- name: Remove existing venv
file:
@ -58,17 +58,14 @@
path: "{{ barbican_bin | dirname }}"
state: directory
register: barbican_venv_dir
when:
- not barbican_developer_mode | bool
when: barbican_get_venv | changed
- name: Unarchive pre-built venv
unarchive:
src: "/var/cache/{{ barbican_venv_download_url | basename }}"
dest: "{{ barbican_bin | dirname }}"
copy: "no"
when:
- not barbican_developer_mode | bool
- barbican_get_venv | changed or barbican_venv_dir | changed
when: barbican_get_venv | changed
notify: Restart barbican services
- name: Install pip packages
@ -85,12 +82,10 @@
until: install_packages|success
retries: 5
delay: 2
when: barbican_developer_mode | bool
when: barbican_get_venv | failed or barbican_get_venv | skipped
notify: Restart barbican services
- name: Update virtualenv path
command: >
virtualenv-tools --update-path=auto --reinitialize {{ barbican_bin | dirname }}
when:
- not barbican_developer_mode | bool
- barbican_get_venv | changed or barbican_venv_dir | changed
when: barbican_get_venv | changed