Make initial pip install use constraints

The get-pip script allows the use of constraints now,
so to provide the maximum protection we should use
it. This also reduces one of the places where we need
to do package pinning.

Change-Id: I4618615b84618401359b5c5c6f51512e6c9a697e
This commit is contained in:
Jesse Pretorius 2017-07-14 12:46:19 +01:00
parent 7cab63d3aa
commit 35809a2fff
2 changed files with 13 additions and 11 deletions

View File

@ -16,9 +16,11 @@
- block:
- name: Install PIP
command: >
python /opt/get-pip.py {{ pip_source_install_options }}
{{ pip_get_pip_options }}
{{ pip_packages | map('quote') | join (' ') }}
python /opt/get-pip.py
{{ pip_source_install_options }}
{{ pip_get_pip_options }}
{{ (pip_install_upper_constraints is defined) | ternary('--constraint ' + pip_install_upper_constraints | default(''),'') }}
{{ pip_packages | map('quote') | join (' ') }}
changed_when: pip_install.stdout.find('Successfully installed') != -1
register: pip_install
until: pip_install | success
@ -28,9 +30,11 @@
rescue:
- name: Install PIP (fall back mode)
command: >
python /opt/get-pip.py --isolated {{ pip_source_install_options }}
{{ pip_get_pip_options }}
{{ pip_packages | map('quote') | join (' ') }}
python /opt/get-pip.py --isolated
{{ pip_source_install_options }}
{{ pip_get_pip_options }}
{{ (pip_install_upper_constraints is defined) | ternary('--constraint ' + pip_install_upper_constraints | default(''),'') }}
{{ pip_packages | map('quote') | join (' ') }}
changed_when: pip_install_fall_back.stdout.find('Successfully installed') != -1
register: pip_install_fall_back
until: pip_install_fall_back | success

View File

@ -16,10 +16,8 @@
- name: Playbook for role testing
hosts: localhost
connection: local
vars:
pip_packages:
- "pip==8.0.3"
pip_install_upper_constraints: "http://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt"
vars_files:
- common/test-vars.yml
roles:
- role: "pip_install"
post_tasks:
@ -44,4 +42,4 @@
that:
- "pip_dir.stat.isdir"
- "pip_selfcheck_file.stat.exists"
- "pip_version.stdout | search('8.0.3')"
- "pip_version.stdout | search('9.0.1')"