From a4c008c8154747a87392e6ce5d316e272f23b1d6 Mon Sep 17 00:00:00 2001 From: Jesse Pretorius Date: Wed, 2 Nov 2016 12:39:28 +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: I6c6214b16168abb571cc2d02bc01a80ba13bbe9f --- defaults/main.yml | 2 -- ...ove-requirements-git-af92138c4d8f9a81.yaml | 7 ++++ tasks/glance_install.yml | 34 +++++-------------- 3 files changed, 15 insertions(+), 28 deletions(-) create mode 100644 releasenotes/notes/remove-requirements-git-af92138c4d8f9a81.yaml diff --git a/defaults/main.yml b/defaults/main.yml index 2aec7673..2e922e64 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -23,8 +23,6 @@ glance_pip_package_state: "latest" glance_git_repo: https://git.openstack.org/openstack/glance glance_git_install_branch: master -glance_requirements_git_repo: https://git.openstack.org/openstack/requirements -glance_requirements_git_install_branch: master glance_developer_mode: false glance_developer_constraints: - "git+{{ glance_git_repo }}@{{ glance_git_install_branch }}#egg=glance" diff --git a/releasenotes/notes/remove-requirements-git-af92138c4d8f9a81.yaml b/releasenotes/notes/remove-requirements-git-af92138c4d8f9a81.yaml new file mode 100644 index 00000000..1e18720e --- /dev/null +++ b/releasenotes/notes/remove-requirements-git-af92138c4d8f9a81.yaml @@ -0,0 +1,7 @@ +--- +upgrade: + - The variables ``glance_requirements_git_repo`` and + ``glance_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/glance_install.yml b/tasks/glance_install.yml index c4f74e44..99c1b515 100644 --- a/tasks/glance_install.yml +++ b/tasks/glance_install.yml @@ -30,36 +30,15 @@ {% for item in glance_developer_constraints %} {{ item }} {% endfor %} - when: - - glance_developer_mode | bool - -- name: Clone requirements git repository - git: - repo: "{{ glance_requirements_git_repo }}" - dest: "/opt/requirements" - clone: yes - update: yes - version: "{{ glance_requirements_git_install_branch }}" - when: - - glance_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: - - glance_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 glance_developer_mode | bool + when: glance_developer_mode | bool - name: Install requires pip packages pip: name: "{{ glance_requires_pip_packages | join(' ') }}" state: "{{ glance_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 @@ -132,7 +111,10 @@ state: "{{ glance_pip_package_state }}" virtualenv: "{{ glance_bin | dirname }}" virtualenv_site_packages: "no" - extra_args: "{{ pip_install_options_fact }}" + extra_args: >- + {{ glance_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