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

View File

@ -37,6 +37,9 @@ glance_bin: "/openstack/venvs/glance-{{ glance_venv_tag }}/bin"
# glance_etc_dir: "/usr/local/etc/glance"
glance_etc_dir: "{{ glance_bin | dirname }}/etc/glance"
# venv_download, even when true, will use the fallback method of building the
# venv from scratch if the venv download fails.
glance_venv_download: "{{ not glance_developer_mode | bool }}"
glance_venv_download_url: http://127.0.0.1/venvs/untagged/ubuntu/glance.tgz
# Enable/Disable Ceilometer

View File

@ -57,7 +57,7 @@
dest: "/var/cache/{{ glance_venv_download_url | basename }}"
checksum: "sha1:{{ lookup('url', glance_venv_download_url | replace('tgz', 'checksum')) }}"
register: glance_get_venv
when: not glance_developer_mode | bool
when: glance_venv_download | bool
- name: Remove existing venv
file:
@ -70,15 +70,14 @@
path: "{{ glance_bin | dirname }}"
state: directory
register: glance_venv_dir
when: glance_get_venv | changed
- name: Unarchive pre-built venv
unarchive:
src: "/var/cache/{{ glance_venv_download_url | basename }}"
dest: "{{ glance_bin | dirname }}"
copy: "no"
when:
- not glance_developer_mode | bool
- glance_get_venv | changed or glance_venv_dir | changed
when: glance_get_venv | changed
notify:
- Restart glance services
@ -96,7 +95,7 @@
until: install_packages|success
retries: 5
delay: 2
when: glance_developer_mode | bool
when: glance_get_venv | failed or glance_get_venv | skipped
notify:
- Restart glance services
@ -106,12 +105,9 @@
state: "absent"
when:
- ansible_pkg_mgr == 'yum'
- not glance_developer_mode | bool
- glance_get_venv | changed or glance_venv_dir | changed
- glance_get_venv | changed
- name: Update virtualenv path
command: >
virtualenv-tools --update-path=auto --reinitialize {{ glance_bin | dirname }}
when:
- not glance_developer_mode | bool
- glance_get_venv | changed or glance_venv_dir | changed
when: glance_get_venv | changed