Add optional pip packages to horizon

In some cases it's necessary to have additional
pip packages when using custom dashboards.

This change will allow to add new packages
without the need of override the variable
horizon_pip_packages using the new one
horizon_optional_pip_packages.

Change-Id: I3cf458c3c152bb85947bb9297637f64eb3d65232
This commit is contained in:
Pedro Magalhães 2016-11-04 14:23:25 +00:00
parent ebc0c965cc
commit 57cbc71938
2 changed files with 20 additions and 0 deletions

View File

@ -256,6 +256,10 @@ horizon_pip_packages:
- sahara_dashboard
- trove_dashboard
# This variable is used to install additional pip packages
# that could be needed for additional dashboards
horizon_optional_pip_packages: []
# This variable is used by the repo_build process to determine
# which host group to check for members of before building the
# pip packages required by this role. The value is picked up

View File

@ -120,6 +120,22 @@
- horizon_get_venv | failed or horizon_developer_mode | bool
notify: Restart apache2
- name: Install optional pip packages
pip:
name: "{{ horizon_optional_pip_packages | join(' ') }}"
state: "{{ horizon_pip_package_state }}"
virtualenv: "{{ horizon_bin | dirname }}"
virtualenv_site_packages: "no"
extra_args: >-
{{ horizon_developer_mode | ternary('--constraint /opt/developer-pip-constraints.txt', '') }}
{{ (pip_install_upper_constraints is defined) | ternary('--constraint ' + pip_install_upper_constraints | default(''),'') }}
{{ pip_install_options | default('') }}
register: install_packages
until: install_packages|success
retries: 5
delay: 2
when: horizon_optional_pip_packages | length > 0
- name: Update virtualenv path
command: >
virtualenv-tools --update-path=auto {{ horizon_bin | dirname }}