Only install to virtual environment

Remove all tasks and variables related to toggling between installation
of rally inside or outside of a Python virtual environment.
Installing within a venv is now the only supported deployment.

Additionally, a few changes have been made to make the creation of the
venv more resistant to interruptions during a run of the role.
* unarchiving a pre-built venv will now also occur when the venv
  directory is created, not only after being downloaded
* virtualenv-tools is run against both pre-built and non pre-built venvs
  to account for interruptions during or prior to unarchiving

Change-Id: I815dff623fce1440a5d60f64bf69f4f563371998
Implements: blueprint only-install-venvs
This commit is contained in:
Anton Khaldin 2016-07-07 22:03:35 -07:00
parent 717c085f63
commit 1e1c8b35b9
3 changed files with 19 additions and 49 deletions

View File

@ -31,15 +31,7 @@ rally_developer_constraints:
# Name of the virtual env to deploy into
rally_venv_tag: untagged
rally_venv_bin: "/openstack/venvs/rally-{{ rally_venv_tag }}/bin"
# Set this to enable or disable installing in a venv
rally_venv_enabled: true
# The bin path defaults to the venv path however if installation in a
# venv is disabled the bin path will be dynamically set based on the
# system path used when the installing.
rally_bin: "{{ rally_venv_bin }}"
rally_bin: "/openstack/venvs/rally-{{ rally_venv_tag }}/bin"
rally_venv_download_url: http://127.0.0.1/venvs/untagged/ubuntu/rally.tgz
@ -58,4 +50,4 @@ rally_pip_packages:
- pymysql
- rally
rally_config_overrides: {}
rally_config_overrides: {}

View File

@ -0,0 +1,5 @@
---
upgrade:
- Installation of rally and its dependent pip packages will now only
occur within a Python virtual environment. The ``rally_venv_bin``,
``rally_venv_enabled`` variables have been removed.

View File

@ -83,7 +83,6 @@
get_md5: False
when:
- not rally_developer_mode | bool
- rally_venv_enabled | bool
register: local_venv_stat
tags:
- rally-install
@ -95,7 +94,6 @@
return_content: True
when:
- not rally_developer_mode | bool
- rally_venv_enabled | bool
register: remote_venv_checksum
tags:
- rally-install
@ -115,7 +113,6 @@
register: get_venv
when:
- not rally_developer_mode | bool
- rally_venv_enabled | bool
- (local_venv_stat.stat.exists == False or
{{ local_venv_stat.stat.checksum is defined and local_venv_stat.stat.checksum != remote_venv_checksum.content | trim }})
tags:
@ -125,17 +122,15 @@
- name: Set rally get_venv fact
set_fact:
rally_get_venv: "{{ get_venv }}"
when: rally_venv_enabled | bool
tags:
- rally-install
- rally-pip-packages
- name: Remove existing venv
file:
path: "{{ rally_venv_bin | dirname }}"
path: "{{ rally_bin | dirname }}"
state: absent
when:
- rally_venv_enabled | bool
- rally_get_venv | changed
tags:
- rally-install
@ -143,12 +138,9 @@
- name: Create rally venv dir
file:
path: "{{ rally_venv_bin | dirname }}"
path: "{{ rally_bin | dirname }}"
state: directory
when:
- not rally_developer_mode | bool
- rally_venv_enabled | bool
- rally_get_venv | changed
register: rally_venv_dir
tags:
- rally-install
- rally-pip-packages
@ -156,32 +148,20 @@
- name: Unarchive pre-built venv
unarchive:
src: "/var/cache/{{ rally_venv_download_url | basename }}"
dest: "{{ rally_venv_bin | dirname }}"
dest: "{{ rally_bin | dirname }}"
copy: "no"
when:
- not rally_developer_mode | bool
- rally_venv_enabled | bool
- rally_get_venv | changed
- rally_get_venv | changed or rally_venv_dir | changed
tags:
- rally-install
- rally-pip-packages
- name: Update virtualenv path
command: >
virtualenv-tools --update-path=auto {{ rally_venv_bin | dirname }}
when:
- not rally_developer_mode | bool
- rally_venv_enabled | bool
- rally_get_venv | success
tags:
- rally-install
- rally-pip-packages
- name: Install pip packages (venv)
- name: Install pip packages
pip:
name: "{{ item }}"
state: latest
virtualenv: "{{ rally_venv_bin | dirname }}"
virtualenv: "{{ rally_bin | dirname }}"
virtualenv_site_packages: "no"
extra_args: "{{ pip_install_options_fact }}"
register: install_packages
@ -190,25 +170,18 @@
delay: 2
with_items: rally_pip_packages
when:
- rally_venv_enabled | bool
- rally_get_venv | failed or rally_developer_mode | bool
tags:
- rally-install
- rally-pip-packages
- name: Install pip packages (no venv)
pip:
name: "{{ item }}"
state: latest
extra_args: "{{ pip_install_options_fact }}"
register: install_packages
until: install_packages|success
retries: 5
delay: 2
with_items: rally_pip_packages
- name: Update virtualenv path
command: >
virtualenv-tools --update-path=auto {{ rally_bin | dirname }}
when:
- not rally_venv_enabled | bool
- not rally_developer_mode | bool
- rally_get_venv | success
tags:
- rally-install
- rally-pip-packages