From c5a0cce3c695ccd6ecb594fc8b3148e085e9a5d2 Mon Sep 17 00:00:00 2001 From: Jesse Pretorius Date: Tue, 18 Oct 2016 22:43:03 +0100 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. The tests/os_keystone-overrides.yml file is removed as it is unnecessary given the merge of https://review.openstack.org/381479 Depends-On: I0e6d43a9f22add78f693e8836f1dd852be74d6c5 Change-Id: Ief9c7f124eb58b986192b2f958c971197d410799 --- defaults/main.yml | 2 -- ...ove-requirements-git-bdf5691b8390ed7c.yaml | 7 ++++ tasks/keystone_install.yml | 34 +++++-------------- tests/os_keystone-overrides.yml | 2 -- 4 files changed, 15 insertions(+), 30 deletions(-) create mode 100644 releasenotes/notes/remove-requirements-git-bdf5691b8390ed7c.yaml delete mode 100644 tests/os_keystone-overrides.yml diff --git a/defaults/main.yml b/defaults/main.yml index 9d7d4d35..5907b4d2 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -28,8 +28,6 @@ keystone_shibboleth_repo: {} # of an OpenStack-Ansible repo_server. keystone_git_repo: https://git.openstack.org/openstack/keystone keystone_git_install_branch: master -keystone_requirements_git_repo: https://git.openstack.org/openstack/requirements -keystone_requirements_git_install_branch: master keystone_developer_mode: false keystone_developer_constraints: - "git+{{ keystone_git_repo }}@{{ keystone_git_install_branch }}#egg=keystone" diff --git a/releasenotes/notes/remove-requirements-git-bdf5691b8390ed7c.yaml b/releasenotes/notes/remove-requirements-git-bdf5691b8390ed7c.yaml new file mode 100644 index 00000000..77c09c5d --- /dev/null +++ b/releasenotes/notes/remove-requirements-git-bdf5691b8390ed7c.yaml @@ -0,0 +1,7 @@ +--- +upgrade: + - The variables ``keystone_requirements_git_repo`` and + ``keystone_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/keystone_install.yml b/tasks/keystone_install.yml index 25cf6a29..d39b3e2f 100644 --- a/tasks/keystone_install.yml +++ b/tasks/keystone_install.yml @@ -40,36 +40,15 @@ {% for item in keystone_developer_constraints %} {{ item }} {% endfor %} - when: - - keystone_developer_mode | bool - -- name: Clone requirements git repository - git: - repo: "{{ keystone_requirements_git_repo }}" - dest: "/opt/requirements" - clone: yes - update: yes - version: "{{ keystone_requirements_git_install_branch }}" - when: - - keystone_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: - - keystone_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 keystone_developer_mode | bool + when: keystone_developer_mode | bool - name: Install required pip packages pip: name: "{{ keystone_requires_pip_packages | join(' ') }}" state: latest - 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 @@ -145,7 +124,10 @@ state: latest virtualenv: "{{ keystone_bin | dirname }}" virtualenv_site_packages: "no" - extra_args: "{{ pip_install_options_fact }}" + extra_args: >- + {{ keystone_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 diff --git a/tests/os_keystone-overrides.yml b/tests/os_keystone-overrides.yml deleted file mode 100644 index f1fa1336..00000000 --- a/tests/os_keystone-overrides.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -install_test_packages: True