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

View File

@ -31,6 +31,9 @@ sahara_bin: "/openstack/venvs/sahara-{{ sahara_venv_tag }}/bin"
sahara_etc_dir: "{{ sahara_bin | dirname }}/etc/sahara"
# venv_download, even when true, will use the fallback method of building the
# venv from scratch if the venv download fails.
sahara_venv_download: "{{ not sahara_developer_mode | bool }}"
sahara_venv_download_url: http://127.0.0.1/venvs/untagged/ubuntu/sahara.tgz
sahara_db_config: /etc/sahara/sahara.conf

View File

@ -43,7 +43,7 @@
dest: "/var/cache/{{ sahara_venv_download_url | basename }}"
checksum: "sha1:{{ lookup('url', sahara_venv_download_url | replace('tgz', 'checksum')) }}"
register: sahara_get_venv
when: not sahara_developer_mode | bool
when: sahara_venv_download | bool
- name: Remove existing venv
file:
@ -57,15 +57,14 @@
state: directory
mode: "0755"
register: sahara_venv_dir
when: sahara_get_venv | changed
- name: Unarchive pre-built venv
unarchive:
src: "/var/cache/{{ sahara_venv_download_url | basename }}"
dest: "{{ sahara_bin | dirname }}"
copy: "no"
when:
- not sahara_developer_mode | bool
- sahara_get_venv | changed or sahara_venv_dir | changed
when: sahara_get_venv | changed
notify:
- Restart sahara services
@ -83,7 +82,7 @@
until: install_packages|success
retries: 5
delay: 2
when: sahara_developer_mode | bool
when: sahara_get_venv | failed or sahara_get_venv | skipped
notify:
- Restart sahara services
@ -93,12 +92,9 @@
state: "absent"
when:
- ansible_pkg_mgr == 'yum'
- not sahara_developer_mode | bool
- sahara_get_venv | changed or sahara_venv_dir | changed
- sahara_get_venv | changed
- name: Update virtualenv path
command: >
virtualenv-tools --update-path=auto --reinitialize {{ sahara_bin | dirname }}
when:
- not sahara_developer_mode | bool
- sahara_get_venv | changed or sahara_venv_dir | changed
when: sahara_get_venv | changed