From 2c7c4865431935de085799b804f0f7969b696ba6 Mon Sep 17 00:00:00 2001 From: Jesse Pretorius Date: Wed, 2 Nov 2016 13:35:41 +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: I2b3aff99b8ee1c8870f89598cf7cf0a2165af3b6 --- defaults/main.yml | 3 -- ...ove-requirements-git-212d02658644c17b.yaml | 7 ++++ tasks/calico_config.yml | 8 +++-- tasks/neutron_install.yml | 34 +++++-------------- 4 files changed, 20 insertions(+), 32 deletions(-) create mode 100644 releasenotes/notes/remove-requirements-git-212d02658644c17b.yaml diff --git a/defaults/main.yml b/defaults/main.yml index 49a62e95..b4e0d4cb 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -36,9 +36,6 @@ neutron_vpnaas_git_install_branch: master neutron_dynamic_routing_git_repo: https://git.openstack.org/openstack/neutron-dynamic-routing neutron_dynamic_routing_git_install_branch: master -neutron_requirements_git_repo: https://git.openstack.org/openstack/requirements -neutron_requirements_git_install_branch: master - calico_git_repo: https://github.com/projectcalico/felix calico_git_package_name: calico calico_git_install_branch: master diff --git a/releasenotes/notes/remove-requirements-git-212d02658644c17b.yaml b/releasenotes/notes/remove-requirements-git-212d02658644c17b.yaml new file mode 100644 index 00000000..dff6b83e --- /dev/null +++ b/releasenotes/notes/remove-requirements-git-212d02658644c17b.yaml @@ -0,0 +1,7 @@ +--- +upgrade: + - The variables ``neutron_requirements_git_repo`` and + ``neutron_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/calico_config.yml b/tasks/calico_config.yml index 4e38013e..5e084bbf 100644 --- a/tasks/calico_config.yml +++ b/tasks/calico_config.yml @@ -15,16 +15,18 @@ - name: Install Calico pip packages pip: - name: "{{ item }}" + name: "{{ neutron_optional_calico_pip_packages | join(' ') }}" state: "{{ neutron_pip_package_state }}" virtualenv: "{{ neutron_bin | dirname }}" virtualenv_site_packages: "no" - extra_args: "{{ pip_install_options_fact }}" + extra_args: >- + {{ neutron_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 - with_items: "{{ neutron_optional_calico_pip_packages }}" when: - neutron_services['neutron-server']['group'] in group_names or neutron_services['calico-felix']['group'] in group_names diff --git a/tasks/neutron_install.yml b/tasks/neutron_install.yml index 051e0e44..b6bc2da0 100644 --- a/tasks/neutron_install.yml +++ b/tasks/neutron_install.yml @@ -26,36 +26,15 @@ {% for item in neutron_developer_constraints %} {{ item }} {% endfor %} - when: - - neutron_developer_mode | bool - -- name: Clone requirements git repository - git: - repo: "{{ neutron_requirements_git_repo }}" - dest: "/opt/requirements" - clone: yes - update: yes - version: "{{ neutron_requirements_git_install_branch }}" - when: - - neutron_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: - - neutron_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 neutron_developer_mode | bool + when: neutron_developer_mode | bool - name: Install requires pip packages pip: name: "{{ neutron_requires_pip_packages | join(' ') }}" state: "{{ neutron_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: "{{ neutron_pip_package_state }}" virtualenv: "{{ neutron_bin | dirname }}" virtualenv_site_packages: "no" - extra_args: "{{ pip_install_options_fact }}" + extra_args: >- + {{ neutron_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