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: Ie19e4e035e5944a984026024aaeebf72313779d2
This commit is contained in:
Logan V 2017-01-13 19:52:42 -06:00
parent 8973e14080
commit 2f1291bf55
2 changed files with 10 additions and 20 deletions

View File

@ -35,6 +35,9 @@ swift_developer_constraints:
swift_venv_tag: untagged
swift_bin: "/openstack/venvs/swift-{{ swift_venv_tag }}/bin"
# venv_download, even when true, will use the fallback method of building the
# venv from scratch if the venv download fails.
swift_venv_download: "{{ not swift_developer_mode | bool and not swift_pypy_enabled | bool }}"
swift_venv_download_url: http://127.0.0.1/venvs/untagged/ubuntu/swift.tgz
# Set the full path to the swift recon cron

View File

@ -69,33 +69,27 @@
dest: "/var/cache/{{ swift_venv_download_url | basename }}"
checksum: "sha1:{{ lookup('url', swift_venv_download_url | replace('tgz', 'checksum')) }}"
register: swift_get_venv
when:
- not swift_pypy_enabled | bool
- not swift_developer_mode | bool
when: swift_venv_download | bool
- name: Remove existing venv
file:
path: "{{ swift_bin | dirname }}"
state: absent
when:
- not swift_pypy_enabled | bool
- swift_get_venv | changed
when: swift_get_venv | changed
- name: Create swift venv dir
file:
path: "{{ swift_bin | dirname }}"
state: directory
register: swift_venv_dir
when: swift_get_venv | changed
- name: Unarchive pre-built venv
unarchive:
src: "/var/cache/{{ swift_venv_download_url | basename }}"
dest: "{{ swift_bin | dirname }}"
copy: "no"
when:
- not swift_pypy_enabled | bool
- not swift_developer_mode | bool
- swift_get_venv | changed or swift_venv_dir | changed
when: swift_get_venv | changed
notify:
- Restart swift services
@ -113,9 +107,7 @@
until: install_packages|success
retries: 5
delay: 2
when:
- not swift_pypy_enabled | bool
- swift_developer_mode | bool
when: swift_get_venv | failed or swift_get_venv | skipped
notify:
- Restart swift services
@ -125,17 +117,12 @@
state: "absent"
when:
- ansible_pkg_mgr == 'yum'
- not swift_pypy_enabled | bool
- not swift_developer_mode | bool
- swift_get_venv | changed or swift_venv_dir | changed
- swift_get_venv | changed
- name: Update virtualenv path
command: >
virtualenv-tools --update-path=auto --reinitialize {{ swift_bin | dirname }}
when:
- not swift_pypy_enabled | bool
- not swift_developer_mode | bool
- swift_get_venv | changed or swift_venv_dir | changed
when: swift_get_venv | changed
- include: swift_pypy_setup.yml
static: no