From 47b5a171ca805135f675a1fee7f997a631480efb Mon Sep 17 00:00:00 2001 From: Jesse Pretorius Date: Wed, 2 Nov 2016 13:22:16 +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: Ie860ef9bc223621140205d465298c4009b86118a --- defaults/main.yml | 2 -- ...ove-requirements-git-0d898621f1b62a29.yaml | 7 ++++ tasks/ironic_install.yml | 34 +++++-------------- 3 files changed, 15 insertions(+), 28 deletions(-) create mode 100644 releasenotes/notes/remove-requirements-git-0d898621f1b62a29.yaml diff --git a/defaults/main.yml b/defaults/main.yml index ab7830dd..9cc5eb0d 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -28,8 +28,6 @@ ironic_pip_package_state: "latest" # of an OpenStack-Ansible repo_server. ironic_git_repo: https://git.openstack.org/openstack/ironic ironic_git_install_branch: master -ironic_requirements_git_repo: https://git.openstack.org/openstack/requirements -ironic_requirements_git_install_branch: master ironic_developer_mode: false ironic_developer_constraints: - "git+{{ ironic_git_repo }}@{{ ironic_git_install_branch }}#egg=ironic" diff --git a/releasenotes/notes/remove-requirements-git-0d898621f1b62a29.yaml b/releasenotes/notes/remove-requirements-git-0d898621f1b62a29.yaml new file mode 100644 index 00000000..7d94a39a --- /dev/null +++ b/releasenotes/notes/remove-requirements-git-0d898621f1b62a29.yaml @@ -0,0 +1,7 @@ +--- +upgrade: + - The variables ``ironic_requirements_git_repo`` and + ``ironic_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/ironic_install.yml b/tasks/ironic_install.yml index 82f3bfbb..1831843f 100644 --- a/tasks/ironic_install.yml +++ b/tasks/ironic_install.yml @@ -20,8 +20,7 @@ {% for item in ironic_developer_constraints %} {{ item }} {% endfor %} - when: - - ironic_developer_mode | bool + when: ironic_developer_mode | bool - include: ironic_install_apt.yml static: no @@ -31,33 +30,13 @@ vars: apt_pkgs: "{{ ironic_developer_mode_distro_packages }}" -- name: Clone requirements git repository - git: - repo: "{{ ironic_requirements_git_repo }}" - dest: "/opt/requirements" - clone: yes - update: yes - version: "{{ ironic_requirements_git_install_branch }}" - when: - - ironic_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: - - ironic_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 ironic_developer_mode | bool - - name: Install requires pip packages pip: name: "{{ ironic_requires_pip_packages | join(' ') }}" state: "{{ ironic_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: "{{ ironic_pip_package_state }}" virtualenv: "{{ ironic_bin | dirname }}" virtualenv_site_packages: "no" - extra_args: "{{ pip_install_options_fact }}" + extra_args: >- + {{ ironic_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