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

View File

@ -28,6 +28,9 @@ cinder_developer_constraints:
cinder_venv_tag: untagged
cinder_bin: "/openstack/venvs/cinder-{{ cinder_venv_tag }}/bin"
# venv_download, even when true, will use the fallback method of building the
# venv from scratch if the venv download fails.
cinder_venv_download: "{{ not cinder_developer_mode | bool }}"
cinder_venv_download_url: http://127.0.0.1/venvs/untagged/ubuntu/cinder.tgz
# Enable/Disable Ceilometer

View File

@ -82,7 +82,7 @@
dest: "/var/cache/{{ cinder_venv_download_url | basename }}"
checksum: "sha1:{{ lookup('url', cinder_venv_download_url | replace('tgz', 'checksum')) }}"
register: cinder_get_venv
when: not cinder_developer_mode | bool
when: cinder_venv_download | bool
- name: Remove existing venv
file:
@ -95,18 +95,14 @@
path: "{{ cinder_bin | dirname }}"
state: directory
register: cinder_venv_dir
when:
- not cinder_developer_mode | bool
- cinder_get_venv | changed
when: cinder_get_venv | changed
- name: Unarchive pre-built venv
unarchive:
src: "/var/cache/{{ cinder_venv_download_url | basename }}"
dest: "{{ cinder_bin | dirname }}"
copy: "no"
when:
- not cinder_developer_mode | bool
- cinder_get_venv | changed or cinder_venv_dir | changed
when: cinder_get_venv | changed
notify: Restart cinder services
- name: Install pip packages
@ -123,7 +119,7 @@
until: install_packages|success
retries: 5
delay: 2
when: cinder_developer_mode | bool
when: cinder_get_venv | failed or cinder_get_venv | skipped
notify: Restart cinder services
- name: CentOS remove python from path first
@ -132,12 +128,9 @@
state: "absent"
when:
- ansible_pkg_mgr == 'yum'
- not cinder_developer_mode | bool
- cinder_get_venv | changed or cinder_venv_dir | changed
- cinder_get_venv | changed
- name: Update virtualenv path
command: >
virtualenv-tools --update-path=auto --reinitialize {{ cinder_bin | dirname }}
when:
- not cinder_developer_mode | bool
- cinder_get_venv | changed or cinder_venv_dir | changed
when: cinder_get_venv | changed