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: Id41f3963f4be4444dca8362e6f71f537f01429f2
This commit is contained in:
Logan V 2017-01-13 19:52:42 -06:00
parent e672bb29df
commit 541537405d
2 changed files with 8 additions and 11 deletions

View File

@ -25,6 +25,9 @@ zaqar_pip_package_state: "latest"
zaqar_venv_tag: untagged
zaqar_bin: "/openstack/venvs/zaqar-{{ zaqar_venv_tag }}/bin"
# venv_download, even when true, will use the fallback method of building the
# venv from scratch if the venv download fails.
zaqar_venv_download: "{{ not zaqar_developer_mode | bool and not zaqar_local_mode | bool }}"
zaqar_venv_download_url: http://127.0.0.1/venvs/untagged/ubuntu/zaqar.tgz
zaqar_venv_localpath: /opt/kong/zaqar.tgz

View File

@ -54,9 +54,7 @@
dest: "/var/cache/{{ zaqar_venv_download_url | basename }}"
checksum: "sha1:{{ lookup('url', zaqar_venv_download_url | replace('tgz', 'checksum')) }}"
register: zaqar_get_venv
when:
- not zaqar_developer_mode | bool
- not zaqar_local_mode | bool
when: zaqar_venv_download | bool
tags:
- zaqar-install
- zaqar-pip-packages
@ -85,6 +83,7 @@
path: "{{ zaqar_bin | dirname }}"
state: directory
register: zaqar_venv_dir
when: zaqar_get_venv | changed
tags:
- zaqar-install
- zaqar-pip-packages
@ -94,9 +93,7 @@
src: "/var/cache/{{ zaqar_venv_download_url | basename }}"
dest: "{{ zaqar_bin | dirname }}"
copy: "no"
when:
- not zaqar_developer_mode | bool or zaqar_local_mode | bool
- zaqar_get_venv | changed or zaqar_venv_dir | changed
when: zaqar_get_venv | changed
# notify:
# - Restart zaqar api
tags:
@ -117,7 +114,7 @@
until: install_packages|success
retries: 5
delay: 2
when: zaqar_developer_mode | bool or zaqar_local_mode | bool
when: zaqar_get_venv | failed or zaqar_get_venv | skipped
# notify:
# - Restart zaqar api
tags:
@ -127,10 +124,7 @@
- name: Update virtualenv path
command: >
virtualenv-tools --update-path=auto --reinitialize {{ zaqar_bin | dirname }}
when:
- not zaqar_developer_mode | bool or zaqar_local_mode | bool
- zaqar_get_venv | changed or zaqar_venv_dir | changed
when: zaqar_get_venv | changed
tags:
- zaqar-install
- zaqar-pip-packages