From d1f10b66fa66e598e94d08ca260a5783714cc193 Mon Sep 17 00:00:00 2001 From: Jesse Pretorius Date: Wed, 2 Nov 2016 13:05:26 +0000 Subject: [PATCH] Simplify pip options/constraints mechanism The current constraints generation for the installation involves multiple tasks and multiple variables. Using multiple tasks extends the installation time unnecessarily and the additional variables are unnecessary. This patch aims to simplify the mechanism and hopes to speed it up a little. Change-Id: I66974d89e3a89620abaf1d228e10a70575b2e067 --- defaults/main.yml | 4 --- ...ove-requirements-git-09e7a42384f30594.yaml | 7 ++++ tasks/horizon_install.yml | 34 +++++-------------- 3 files changed, 15 insertions(+), 30 deletions(-) create mode 100644 releasenotes/notes/remove-requirements-git-09e7a42384f30594.yaml diff --git a/defaults/main.yml b/defaults/main.yml index 1291301a..17ef5acb 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -28,10 +28,6 @@ horizon_developer_mode: false horizon_git_repo: https://git.openstack.org/openstack/horizon horizon_git_install_branch: master -## The git source/branch for the upper-constraints (used in developer mode) -horizon_requirements_git_repo: https://git.openstack.org/openstack/requirements -horizon_requirements_git_install_branch: master - ## The git source/branch for the Magnum UI plugin magnum_dashboard_git_repo: https://git.openstack.org/openstack/magnum-ui magnum_dashboard_git_install_branch: master diff --git a/releasenotes/notes/remove-requirements-git-09e7a42384f30594.yaml b/releasenotes/notes/remove-requirements-git-09e7a42384f30594.yaml new file mode 100644 index 00000000..9ea31eac --- /dev/null +++ b/releasenotes/notes/remove-requirements-git-09e7a42384f30594.yaml @@ -0,0 +1,7 @@ +--- +upgrade: + - The variables ``horizon_requirements_git_repo`` and + ``horizon_requirements_git_install_branch`` have been + removed in favour of using the URL/path to the + upper-constraints file using the + variable ``pip_install_upper_constraints`` instead. diff --git a/tasks/horizon_install.yml b/tasks/horizon_install.yml index 7ff470a6..7d492ba9 100644 --- a/tasks/horizon_install.yml +++ b/tasks/horizon_install.yml @@ -25,36 +25,15 @@ {% for item in horizon_developer_constraints %} {{ item }} {% endfor %} - when: - - horizon_developer_mode | bool - -- name: Clone requirements git repository - git: - repo: "{{ horizon_requirements_git_repo }}" - dest: "/opt/requirements" - clone: yes - update: yes - version: "{{ horizon_requirements_git_install_branch }}" - when: - - horizon_developer_mode | bool - -- name: Add constraints to pip_install_options fact for developer mode - set_fact: - pip_install_options_fact: "{{ pip_install_options|default('') }} --constraint /opt/developer-pip-constraints.txt --constraint /opt/requirements/upper-constraints.txt" - when: - - horizon_developer_mode | bool - -- name: Set pip_install_options_fact when not in developer mode - set_fact: - pip_install_options_fact: "{{ pip_install_options|default('') }}" - when: - - not horizon_developer_mode | bool + when: horizon_developer_mode | bool - name: Install requires pip packages pip: name: "{{ horizon_requires_pip_packages | join(' ') }}" state: "{{ horizon_pip_package_state }}" - extra_args: "{{ pip_install_options_fact }}" + extra_args: >- + {{ (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 @@ -129,7 +108,10 @@ state: "{{ horizon_pip_package_state }}" virtualenv: "{{ horizon_bin | dirname }}" virtualenv_site_packages: "no" - extra_args: "{{ pip_install_options_fact }}" + 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