Only install to virtual environment
Remove all tasks and variables related to toggling between installation of cloudkitty 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: I84dd86e4e8244de5a6ac55a302df0c9737d6388e Implements: blueprint only-install-venvs
This commit is contained in:
Jimmy McCrory
committed by
Anton Khaldin
parent
3828fccefe
commit
f76b9ee74b
6 changed files with 18 additions and 80 deletions
@@ -28,15 +28,7 @@ cloudkitty_system_shell: /bin/false
cloudkitty_system_home_folder:"/var/lib/{{ cloudkitty_system_user_name }}"
cloudkitty_venv_tag:untagged
cloudkitty_venv_bin:"/openstack/venvs/cloudkitty-{{ cloudkitty_venv_tag }}/bin"
# Set this to enable or disable installing in a venv
cloudkitty_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.
cloudkitty_bin:"{{ cloudkitty_venv_bin }}"
cloudkitty_bin:"/openstack/venvs/cloudkitty-{{ cloudkitty_venv_tag }}/bin"
cloudkitty_venv_download_url:http://127.0.0.1/venvs/untagged/ubuntu/cloudkitty.tgz
@@ -0,0 +1,5 @@
---
upgrade:
- Installation of cloudkitty and its dependent pip packages will now only
occur within a Python virtual environment. The ``cloudkitty_venv_bin``
and ``cloudkitty_venv_enabled`` variables have been removed.
@@ -79,7 +79,6 @@
get_md5:False
when:
- not cloudkitty_developer_mode | bool
- cloudkitty_venv_enabled | bool
register:local_venv_stat
tags:
- cloudkitty-install
@@ -91,7 +90,6 @@
return_content:True
when:
- not cloudkitty_developer_mode | bool
- cloudkitty_venv_enabled | bool
register:remote_venv_checksum
tags:
- cloudkitty-install
@@ -111,7 +109,6 @@
register:get_venv
when:
- not cloudkitty_developer_mode | bool
- cloudkitty_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:
@@ -121,17 +118,15 @@
- name:Set cloudkitty get_venv fact
set_fact:
cloudkitty_get_venv:"{{ get_venv }}"
when:cloudkitty_venv_enabled | bool
tags:
- cloudkitty-install
- cloudkitty-pip-packages
- name:Remove existing venv
file:
path:"{{ cloudkitty_venv_bin | dirname }}"
path:"{{ cloudkitty_bin | dirname }}"
state:absent
when:
- cloudkitty_venv_enabled | bool
- cloudkitty_get_venv | changed
tags:
- cloudkitty-install
@@ -139,12 +134,9 @@
- name:Create cloudkitty venv dir
file:
path:"{{ cloudkitty_venv_bin | dirname }}"
path:"{{ cloudkitty_bin | dirname }}"
state:directory
when:
- not cloudkitty_developer_mode | bool
- cloudkitty_venv_enabled | bool
- cloudkitty_get_venv | changed
register:cloudkitty_venv_dir
tags:
- cloudkitty-install
- cloudkitty-pip-packages
@@ -152,34 +144,22 @@
- name:Unarchive pre-built venv
unarchive:
src:"/var/cache/{{ cloudkitty_venv_download_url | basename }}"
dest:"{{ cloudkitty_venv_bin | dirname }}"
dest:"{{ cloudkitty_bin | dirname }}"
copy:"no"
when:
- not cloudkitty_developer_mode | bool
- cloudkitty_venv_enabled | bool
- cloudkitty_get_venv | changed
- cloudkitty_get_venv | changed or cloudkitty_venv_dir | changed
notify:
- Restart cloudkitty services
tags:
- cloudkitty-install
- cloudkitty-pip-packages
- name:Update virtualenv path
command:>
virtualenv-tools --update-path=auto {{ cloudkitty_venv_bin | dirname }}
when:
- not cloudkitty_developer_mode | bool
- cloudkitty_venv_enabled | bool
- cloudkitty_get_venv | success
tags:
- cloudkitty-install
- cloudkitty-pip-packages
- name:Install pip packages (venv)
- name:Install pip packages
pip:
name:"{{ item }}"
state:latest
virtualenv:"{{ cloudkitty_venv_bin | dirname }}"
virtualenv:"{{ cloudkitty_bin | dirname }}"
virtualenv_site_packages:"no"
extra_args:"{{ pip_install_options_fact }}"
register:install_packages
@@ -188,7 +168,6 @@
delay:2
with_items:cloudkitty_pip_packages
when:
- cloudkitty_venv_enabled | bool
- cloudkitty_get_venv | failed or cloudkitty_developer_mode | bool
notify:
- Restart cloudkitty services
@@ -196,21 +175,12 @@
- cloudkitty-install
- cloudkitty-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:cloudkitty_pip_packages
- name:Update virtualenv path
command:>
virtualenv-tools --update-path=auto {{ cloudkitty_bin | dirname }}
when:
- not cloudkitty_developer_mode | bool
- not cloudkitty_venv_enabled | bool
notify:
- Restart cloudkitty services
- cloudkitty_get_venv | success
tags:
- cloudkitty-install
- cloudkitty-pip-packages
@@ -41,19 +41,3 @@
- Restart cloudkitty services
tags:
- cloudkitty-config
- name:Get cloudkitty command path
command:which cloudkitty
register:cloudkitty_command_path
when:
- not cloudkitty_venv_enabled | bool
tags:
- cloudkitty-command-bin
- name:Set cloudkitty command path
set_fact:
cloudkitty_bin:"{{ cloudkitty_command_path.stdout | dirname }}"
when:
- not cloudkitty_venv_enabled | bool
tags:
- cloudkitty-command-bin
@@ -48,17 +48,6 @@
tags:
- cloudkitty-dirs
- name:Create cloudkitty venv dir
file:
path:"{{ item.path }}"
state:directory
with_items:
- {path:"/openstack/venvs"}
- {path:"{{ cloudkitty_venv_bin | dirname }}"}
when:cloudkitty_venv_enabled | bool
tags:
- cloudkitty-dirs
- name:Test for log directory or link
shell:|
if [ -h "/var/log/cloudkitty" ]; then
@@ -23,9 +23,7 @@ chown {{ system_user }}:{{ system_group }} "/var/run/{{ program_name }}"
mkdir -p "/var/lock/{{ program_name }}"
chown {{ system_user }}:{{ system_group }} "/var/lock/{{ program_name }}"
{% if cloudkitty_venv_enabled | bool -%}
. {{ cloudkitty_venv_bin }}/activate
{%- endif %}
. {{ cloudkitty_bin }}/activate
end script
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.