Only install to virtual environment
Remove all tasks and variables related to toggling between installation of zaqar 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: I4a67a53d3d685c1e2f937114352569c9f45a74a0 Implements: blueprint only-install-venvs
This commit is contained in:
parent
32b621d888
commit
e3d63ab1ef
@ -18,15 +18,7 @@ debug: False
|
||||
|
||||
# Name of the virtual env to deploy into
|
||||
zaqar_venv_tag: untagged
|
||||
zaqar_venv_bin: "/openstack/venvs/zaqar-{{ zaqar_venv_tag }}/bin"
|
||||
|
||||
# Set this to enable or disable installing in a venv
|
||||
zaqar_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.
|
||||
zaqar_bin: "{{ zaqar_venv_bin }}"
|
||||
zaqar_bin: "/openstack/venvs/zaqar-{{ zaqar_venv_tag }}/bin"
|
||||
|
||||
zaqar_venv_download_url: http://127.0.0.1/venvs/untagged/ubuntu/zaqar.tgz
|
||||
zaqar_venv_localpath: /opt/kong/zaqar.tgz
|
||||
|
@ -0,0 +1,5 @@
|
||||
---
|
||||
upgrade:
|
||||
- Installation of zaqar and its dependent pip packages will now only
|
||||
occur within a Python virtual environment. The ``zaqar_venv_enabled``,
|
||||
``zaqar_venv_bin`` variables have been removed.
|
@ -78,7 +78,6 @@
|
||||
get_md5: False
|
||||
when:
|
||||
- not zaqar_developer_mode | bool
|
||||
- zaqar_venv_enabled | bool
|
||||
- not zaqar_local_mode | bool
|
||||
register: local_venv_stat
|
||||
tags:
|
||||
@ -91,7 +90,6 @@
|
||||
return_content: True
|
||||
when:
|
||||
- not zaqar_developer_mode | bool
|
||||
- zaqar_venv_enabled | bool
|
||||
- not zaqar_local_mode | bool
|
||||
register: remote_venv_checksum
|
||||
tags:
|
||||
@ -113,7 +111,6 @@
|
||||
when:
|
||||
- not zaqar_developer_mode | bool
|
||||
- not zaqar_local_mode | bool
|
||||
- zaqar_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:
|
||||
@ -134,17 +131,15 @@
|
||||
- name: Set zaqar get_venv fact
|
||||
set_fact:
|
||||
zaqar_get_venv: "{{ get_venv }}"
|
||||
when: zaqar_venv_enabled | bool
|
||||
tags:
|
||||
- zaqar-install
|
||||
- zaqar-pip-packages
|
||||
|
||||
- name: Remove existing venv
|
||||
file:
|
||||
path: "{{ zaqar_venv_bin | dirname }}"
|
||||
path: "{{ zaqar_bin | dirname }}"
|
||||
state: absent
|
||||
when:
|
||||
- zaqar_venv_enabled | bool
|
||||
- zaqar_get_venv | changed
|
||||
tags:
|
||||
- zaqar-install
|
||||
@ -152,12 +147,9 @@
|
||||
|
||||
- name: Create zaqar venv dir
|
||||
file:
|
||||
path: "{{ zaqar_venv_bin | dirname }}"
|
||||
path: "{{ zaqar_bin | dirname }}"
|
||||
state: directory
|
||||
when:
|
||||
- not zaqar_developer_mode | bool or zaqar_local_mode | bool
|
||||
- zaqar_venv_enabled | bool
|
||||
- zaqar_get_venv | changed
|
||||
register: zaqar_venv_dir
|
||||
tags:
|
||||
- zaqar-install
|
||||
- zaqar-pip-packages
|
||||
@ -165,34 +157,22 @@
|
||||
- name: Unarchive pre-built venv
|
||||
unarchive:
|
||||
src: "/var/cache/{{ zaqar_venv_download_url | basename }}"
|
||||
dest: "{{ zaqar_venv_bin | dirname }}"
|
||||
dest: "{{ zaqar_bin | dirname }}"
|
||||
copy: "no"
|
||||
when:
|
||||
- not zaqar_developer_mode | bool or zaqar_local_mode | bool
|
||||
- zaqar_venv_enabled | bool
|
||||
- zaqar_get_venv | changed
|
||||
- zaqar_get_venv | changed or zaqar_venv_dir | changed
|
||||
# notify:
|
||||
# - Restart zaqar api
|
||||
tags:
|
||||
- zaqar-install
|
||||
- zaqar-pip-packages
|
||||
|
||||
- name: Update virtualenv path
|
||||
command: >
|
||||
virtualenv-tools --update-path=auto {{ zaqar_venv_bin | dirname }}
|
||||
when:
|
||||
- not zaqar_developer_mode | bool or zaqar_local_mode | bool
|
||||
- zaqar_venv_enabled | bool
|
||||
- zaqar_get_venv | success
|
||||
tags:
|
||||
- zaqar-install
|
||||
- zaqar-pip-packages
|
||||
|
||||
- name: Install pip packages (venv)
|
||||
pip:
|
||||
name: "{{ item }}"
|
||||
state: latest
|
||||
virtualenv: "{{ zaqar_venv_bin | dirname }}"
|
||||
virtualenv: "{{ zaqar_bin | dirname }}"
|
||||
virtualenv_site_packages: "no"
|
||||
extra_args: "{{ pip_install_options|default('') }}"
|
||||
register: install_packages
|
||||
@ -201,7 +181,6 @@
|
||||
delay: 2
|
||||
with_items: "{{ zaqar_pip_packages }}"
|
||||
when:
|
||||
- zaqar_venv_enabled | bool
|
||||
- zaqar_get_venv | failed or zaqar_developer_mode | bool or zaqar_local_mode | bool
|
||||
# notify:
|
||||
# - Restart zaqar api
|
||||
@ -209,22 +188,13 @@
|
||||
- zaqar-install
|
||||
- zaqar-pip-packages
|
||||
|
||||
- name: Install pip packages (no venv)
|
||||
pip:
|
||||
name: "{{ item }}"
|
||||
state: latest
|
||||
extra_args: "{{ pip_install_options|default('') }}"
|
||||
register: install_packages
|
||||
until: install_packages|success
|
||||
retries: 5
|
||||
delay: 2
|
||||
with_items: "{{ zaqar_pip_packages }}"
|
||||
- name: Update virtualenv path
|
||||
command: >
|
||||
virtualenv-tools --update-path=auto {{ zaqar_bin | dirname }}
|
||||
when:
|
||||
- not zaqar_developer_mode | bool
|
||||
- not zaqar_venv_enabled | bool
|
||||
- not zaqar_local_mode | bool
|
||||
# notify:
|
||||
# - Restart zaqar api
|
||||
- not zaqar_developer_mode | bool or zaqar_local_mode | bool
|
||||
- zaqar_get_venv | success
|
||||
tags:
|
||||
- zaqar-install
|
||||
- zaqar-pip-packages
|
||||
|
||||
|
@ -36,18 +36,3 @@
|
||||
- zaqar-config
|
||||
- zaqar-post-install
|
||||
|
||||
- name: Get zaqar command path
|
||||
command: which zaqar
|
||||
register: zaqar_command_path
|
||||
when:
|
||||
- not zaqar_venv_enabled | bool
|
||||
tags:
|
||||
- zaqar-command-bin
|
||||
|
||||
- name: Set zaqar command path
|
||||
set_fact:
|
||||
zaqar_bin: "{{ zaqar_command_path.stdout | dirname }}"
|
||||
when:
|
||||
- not zaqar_venv_enabled | bool
|
||||
tags:
|
||||
- zaqar-command-bin
|
||||
|
@ -51,17 +51,6 @@
|
||||
tags:
|
||||
- zaqar-dirs
|
||||
|
||||
- name: Create zaqar venv dir
|
||||
file:
|
||||
path: "{{ item.path }}"
|
||||
state: directory
|
||||
with_items:
|
||||
- { path: "/openstack/venvs" }
|
||||
- { path: "{{ zaqar_venv_bin }}" }
|
||||
when: zaqar_venv_enabled | bool
|
||||
tags:
|
||||
- zaqar-dirs
|
||||
|
||||
- name: Test for log directory or link
|
||||
shell: |
|
||||
if [ -h "/var/log/zaqar" ]; then
|
||||
|
@ -25,9 +25,7 @@ pre-start script
|
||||
mkdir -p "/var/lock/{{ zaqar_api_program_name }}"
|
||||
chown {{ zaqar_system_user_name }}:{{ zaqar_system_group_name }} "/var/lock/{{ zaqar_api_program_name }}"
|
||||
|
||||
{% if zaqar_venv_enabled | bool -%}
|
||||
. {{ zaqar_venv_bin }}/activate
|
||||
{%- endif %}
|
||||
. {{ zaqar_bin }}/activate
|
||||
|
||||
end script
|
||||
|
||||
|
@ -14,10 +14,8 @@
|
||||
|
||||
import os
|
||||
|
||||
{% if zaqar_venv_enabled | bool %}
|
||||
activate_this = os.path.expanduser("{{ zaqar_venv_bin }}/activate_this.py")
|
||||
activate_this = os.path.expanduser("{{ zaqar_bin }}/activate_this.py")
|
||||
execfile(activate_this, dict(__file__=activate_this))
|
||||
{% endif %}
|
||||
|
||||
from keystonemiddleware import auth_token
|
||||
from zaqar.transport.wsgi import app
|
||||
|
Loading…
Reference in New Issue
Block a user