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:
parent
8973e14080
commit
2f1291bf55
@ -35,6 +35,9 @@ swift_developer_constraints:
|
|||||||
swift_venv_tag: untagged
|
swift_venv_tag: untagged
|
||||||
swift_bin: "/openstack/venvs/swift-{{ swift_venv_tag }}/bin"
|
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
|
swift_venv_download_url: http://127.0.0.1/venvs/untagged/ubuntu/swift.tgz
|
||||||
|
|
||||||
# Set the full path to the swift recon cron
|
# Set the full path to the swift recon cron
|
||||||
|
@ -69,33 +69,27 @@
|
|||||||
dest: "/var/cache/{{ swift_venv_download_url | basename }}"
|
dest: "/var/cache/{{ swift_venv_download_url | basename }}"
|
||||||
checksum: "sha1:{{ lookup('url', swift_venv_download_url | replace('tgz', 'checksum')) }}"
|
checksum: "sha1:{{ lookup('url', swift_venv_download_url | replace('tgz', 'checksum')) }}"
|
||||||
register: swift_get_venv
|
register: swift_get_venv
|
||||||
when:
|
when: swift_venv_download | bool
|
||||||
- not swift_pypy_enabled | bool
|
|
||||||
- not swift_developer_mode | bool
|
|
||||||
|
|
||||||
- name: Remove existing venv
|
- name: Remove existing venv
|
||||||
file:
|
file:
|
||||||
path: "{{ swift_bin | dirname }}"
|
path: "{{ swift_bin | dirname }}"
|
||||||
state: absent
|
state: absent
|
||||||
when:
|
when: swift_get_venv | changed
|
||||||
- not swift_pypy_enabled | bool
|
|
||||||
- swift_get_venv | changed
|
|
||||||
|
|
||||||
- name: Create swift venv dir
|
- name: Create swift venv dir
|
||||||
file:
|
file:
|
||||||
path: "{{ swift_bin | dirname }}"
|
path: "{{ swift_bin | dirname }}"
|
||||||
state: directory
|
state: directory
|
||||||
register: swift_venv_dir
|
register: swift_venv_dir
|
||||||
|
when: swift_get_venv | changed
|
||||||
|
|
||||||
- name: Unarchive pre-built venv
|
- name: Unarchive pre-built venv
|
||||||
unarchive:
|
unarchive:
|
||||||
src: "/var/cache/{{ swift_venv_download_url | basename }}"
|
src: "/var/cache/{{ swift_venv_download_url | basename }}"
|
||||||
dest: "{{ swift_bin | dirname }}"
|
dest: "{{ swift_bin | dirname }}"
|
||||||
copy: "no"
|
copy: "no"
|
||||||
when:
|
when: swift_get_venv | changed
|
||||||
- not swift_pypy_enabled | bool
|
|
||||||
- not swift_developer_mode | bool
|
|
||||||
- swift_get_venv | changed or swift_venv_dir | changed
|
|
||||||
notify:
|
notify:
|
||||||
- Restart swift services
|
- Restart swift services
|
||||||
|
|
||||||
@ -113,9 +107,7 @@
|
|||||||
until: install_packages|success
|
until: install_packages|success
|
||||||
retries: 5
|
retries: 5
|
||||||
delay: 2
|
delay: 2
|
||||||
when:
|
when: swift_get_venv | failed or swift_get_venv | skipped
|
||||||
- not swift_pypy_enabled | bool
|
|
||||||
- swift_developer_mode | bool
|
|
||||||
notify:
|
notify:
|
||||||
- Restart swift services
|
- Restart swift services
|
||||||
|
|
||||||
@ -125,17 +117,12 @@
|
|||||||
state: "absent"
|
state: "absent"
|
||||||
when:
|
when:
|
||||||
- ansible_pkg_mgr == 'yum'
|
- ansible_pkg_mgr == 'yum'
|
||||||
- not swift_pypy_enabled | bool
|
- swift_get_venv | changed
|
||||||
- not swift_developer_mode | bool
|
|
||||||
- swift_get_venv | changed or swift_venv_dir | changed
|
|
||||||
|
|
||||||
- name: Update virtualenv path
|
- name: Update virtualenv path
|
||||||
command: >
|
command: >
|
||||||
virtualenv-tools --update-path=auto --reinitialize {{ swift_bin | dirname }}
|
virtualenv-tools --update-path=auto --reinitialize {{ swift_bin | dirname }}
|
||||||
when:
|
when: swift_get_venv | changed
|
||||||
- not swift_pypy_enabled | bool
|
|
||||||
- not swift_developer_mode | bool
|
|
||||||
- swift_get_venv | changed or swift_venv_dir | changed
|
|
||||||
|
|
||||||
- include: swift_pypy_setup.yml
|
- include: swift_pypy_setup.yml
|
||||||
static: no
|
static: no
|
||||||
|
Loading…
x
Reference in New Issue
Block a user