Only install to virtual environment
Remove all tasks and variables related to toggling between installation of sahara 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: I1ca77e5125911a6d6ac0745abd2259ee3ece4612 Implements: blueprint only-install-venvs
This commit is contained in:
parent
9d27388916
commit
625304c636
@ -23,24 +23,10 @@ sahara_developer_constraints:
|
||||
- "git+{{ sahara_git_repo }}@{{ sahara_git_install_branch }}#egg=sahara"
|
||||
|
||||
# Name of the virtual env to deploy into
|
||||
sahara_venv_tag: untagged
|
||||
sahara_venv_bin: "/openstack/venvs/sahara-{{ sahara_venv_tag }}/bin"
|
||||
sahara_venv_tag: untagged
|
||||
sahara_bin: "/openstack/venvs/sahara-{{ sahara_venv_tag }}/bin"
|
||||
|
||||
# Set this to enable or disable installing in a venv
|
||||
sahara_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.
|
||||
sahara_bin: "{{ sahara_venv_bin }}"
|
||||
|
||||
# Set the etc dir path where sahara is installed.
|
||||
# This is used for role access to the db migrations.
|
||||
# Example:
|
||||
# sahara_etc_dir: "/usr/local/etc/sahara"
|
||||
sahara_venv_etc_dir: "{{ sahara_bin | dirname }}/etc/sahara"
|
||||
sahara_non_venv_etc_dir: "/usr/local/etc/sahara"
|
||||
sahara_etc_dir: "{{ (sahara_venv_enabled | bool) | ternary(sahara_venv_etc_dir, sahara_non_venv_etc_dir) }}"
|
||||
sahara_etc_dir: "{{ sahara_bin | dirname }}/etc/sahara"
|
||||
|
||||
sahara_venv_download_url: http://127.0.0.1/venvs/untagged/ubuntu/sahara.tgz
|
||||
|
||||
|
@ -0,0 +1,6 @@
|
||||
---
|
||||
upgrade:
|
||||
- Installation of sahara and its dependent pip packages will now only
|
||||
occur within a Python virtual environment. The ``sahara_venv_bin``,
|
||||
``sahara_venv_enabled``, ``sahara_venv_etc_dir``, and
|
||||
``sahara_non_venv_etc_dir`` variables have been removed.
|
@ -82,7 +82,6 @@
|
||||
get_md5: False
|
||||
when:
|
||||
- not sahara_developer_mode | bool
|
||||
- sahara_venv_enabled | bool
|
||||
register: local_venv_stat
|
||||
tags:
|
||||
- sahara-install
|
||||
@ -94,7 +93,6 @@
|
||||
return_content: True
|
||||
when:
|
||||
- not sahara_developer_mode | bool
|
||||
- sahara_venv_enabled | bool
|
||||
register: remote_venv_checksum
|
||||
tags:
|
||||
- sahara-install
|
||||
@ -114,7 +112,6 @@
|
||||
register: get_venv
|
||||
when:
|
||||
- not sahara_developer_mode | bool
|
||||
- sahara_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:
|
||||
@ -124,17 +121,15 @@
|
||||
- name: Set sahara get_venv fact
|
||||
set_fact:
|
||||
sahara_get_venv: "{{ get_venv }}"
|
||||
when: sahara_venv_enabled | bool
|
||||
tags:
|
||||
- sahara-install
|
||||
- sahara-pip-packages
|
||||
|
||||
- name: Remove existing venv
|
||||
file:
|
||||
path: "{{ sahara_venv_bin | dirname }}"
|
||||
path: "{{ sahara_bin | dirname }}"
|
||||
state: absent
|
||||
when:
|
||||
- sahara_venv_enabled | bool
|
||||
- sahara_get_venv | changed
|
||||
tags:
|
||||
- sahara-install
|
||||
@ -142,12 +137,9 @@
|
||||
|
||||
- name: Create sahara venv dir
|
||||
file:
|
||||
path: "{{ sahara_venv_bin | dirname }}"
|
||||
path: "{{ sahara_bin | dirname }}"
|
||||
state: directory
|
||||
when:
|
||||
- not sahara_developer_mode | bool
|
||||
- sahara_venv_enabled | bool
|
||||
- sahara_get_venv | changed
|
||||
register: sahara_venv_dir
|
||||
tags:
|
||||
- sahara-install
|
||||
- sahara-pip-packages
|
||||
@ -155,34 +147,22 @@
|
||||
- name: Unarchive pre-built venv
|
||||
unarchive:
|
||||
src: "/var/cache/{{ sahara_venv_download_url | basename }}"
|
||||
dest: "{{ sahara_venv_bin | dirname }}"
|
||||
dest: "{{ sahara_bin | dirname }}"
|
||||
copy: "no"
|
||||
when:
|
||||
- not sahara_developer_mode | bool
|
||||
- sahara_venv_enabled | bool
|
||||
- sahara_get_venv | changed
|
||||
- sahara_get_venv | changed or sahara_venv_dir | changed
|
||||
notify:
|
||||
- Restart sahara services
|
||||
tags:
|
||||
- sahara-install
|
||||
- sahara-pip-packages
|
||||
|
||||
- name: Update virtualenv path
|
||||
command: >
|
||||
virtualenv-tools --update-path=auto {{ sahara_venv_bin | dirname }}
|
||||
when:
|
||||
- not sahara_developer_mode | bool
|
||||
- sahara_venv_enabled | bool
|
||||
- sahara_get_venv | success
|
||||
tags:
|
||||
- sahara-install
|
||||
- sahara-pip-packages
|
||||
|
||||
- name: Install pip packages (venv)
|
||||
pip:
|
||||
name: "{{ item }}"
|
||||
state: present
|
||||
virtualenv: "{{ sahara_venv_bin | dirname }}"
|
||||
virtualenv: "{{ sahara_bin | dirname }}"
|
||||
virtualenv_site_packages: "no"
|
||||
extra_args: "{{ pip_install_options_fact }}"
|
||||
register: install_packages
|
||||
@ -191,7 +171,6 @@
|
||||
delay: 2
|
||||
with_items: "{{ sahara_pip_packages }}"
|
||||
when:
|
||||
- sahara_venv_enabled | bool
|
||||
- sahara_get_venv | failed or sahara_developer_mode | bool
|
||||
notify:
|
||||
- Restart sahara services
|
||||
@ -199,21 +178,13 @@
|
||||
- sahara-install
|
||||
- sahara-pip-packages
|
||||
|
||||
- name: Install pip packages (no venv)
|
||||
pip:
|
||||
name: "{{ item }}"
|
||||
state: present
|
||||
extra_args: "{{ pip_install_options_fact }}"
|
||||
register: install_packages
|
||||
until: install_packages|success
|
||||
retries: 5
|
||||
delay: 2
|
||||
with_items: "{{ sahara_pip_packages }}"
|
||||
- name: Update virtualenv path
|
||||
command: >
|
||||
virtualenv-tools --update-path=auto {{ sahara_bin | dirname }}
|
||||
when:
|
||||
- not sahara_venv_enabled | bool
|
||||
- not sahara_developer_mode | bool
|
||||
notify:
|
||||
- Restart sahara services
|
||||
- sahara_get_venv | success
|
||||
tags:
|
||||
- sahara-install
|
||||
- sahara-pip-packages
|
||||
|
||||
|
@ -39,18 +39,3 @@
|
||||
tags:
|
||||
- sahara-config
|
||||
|
||||
- name: Get sahara command path
|
||||
command: which sahara
|
||||
register: sahara_command_path
|
||||
when:
|
||||
- not sahara_venv_enabled | bool
|
||||
tags:
|
||||
- sahara-command-bin
|
||||
|
||||
- name: Set sahara command path
|
||||
set_fact:
|
||||
sahara_bin: "{{ sahara_command_path.stdout | dirname }}"
|
||||
when:
|
||||
- not sahara_venv_enabled | bool
|
||||
tags:
|
||||
- sahara-command-bin
|
||||
|
@ -46,17 +46,6 @@
|
||||
tags:
|
||||
- sahara-dirs
|
||||
|
||||
- name: Create sahara venv dir
|
||||
file:
|
||||
path: "{{ item.path }}"
|
||||
state: directory
|
||||
with_items:
|
||||
- { path: "/openstack/venvs" }
|
||||
- { path: "{{ sahara_venv_bin }}" }
|
||||
when: sahara_venv_enabled | bool
|
||||
tags:
|
||||
- sahara-dirs
|
||||
|
||||
- name: Test for log directory or link
|
||||
shell: |
|
||||
if [ -h "/var/log/sahara" ]; then
|
||||
|
@ -23,9 +23,7 @@ pre-start script
|
||||
mkdir -p "/var/lock/{{ program_name }}"
|
||||
chown {{ system_user }}:{{ system_group }} "/var/lock/{{ program_name }}"
|
||||
|
||||
{% if sahara_venv_enabled | bool -%}
|
||||
. {{ sahara_venv_bin }}/activate
|
||||
{%- endif %}
|
||||
. {{ sahara_bin }}/activate
|
||||
|
||||
end script
|
||||
|
||||
|
@ -102,7 +102,7 @@ sahara_container_mysql_password: "SuperSecrete"
|
||||
sahara_rabbitmq_password: "secrete"
|
||||
sahara_rabbitmq_userid: sahara
|
||||
sahara_rabbitmq_vhost: /sahara
|
||||
sahara_venv_bin: "/openstack/venvs/sahara-{{ sahara_venv_tag }}/bin"
|
||||
sahara_bin: "/openstack/venvs/sahara-{{ sahara_venv_tag }}/bin"
|
||||
tempest_developer_mode: True
|
||||
tempest_git_install_branch: master
|
||||
tempest_venv_tag: "{{ tempest_git_install_branch }}"
|
||||
|
Loading…
x
Reference in New Issue
Block a user