184dbb8e18
Version 3.2 has a bug with it on some systems that can result in the following stacktrace: [ http://paste.openstack.org/show/726064 ]. To correct this issue the version of the get-pip script has been set to 3.3 which does not suffer from the same issue. Change-Id: I61a7234dc4fbde1b9319874d82fe33578f490abc Partial-Bug: 1779534
114 lines
3.8 KiB
YAML
114 lines
3.8 KiB
YAML
---
|
|
# Copyright 2016, Rackspace US, Inc.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
# This set of tasks checks whether the repo is up yet. If it is it
|
|
# will use it as the source for constraints and as the default index.
|
|
# If it is not yet up, then it will use the upstream upper constraints
|
|
# for the SHA currently pinned and will set the default index to pypi.
|
|
|
|
- name: Backup the default pip_upstream_url
|
|
set_fact:
|
|
__pip_upstream_url: "{{ pip_upstream_url }}"
|
|
when:
|
|
- __pip_upstream_url is not defined
|
|
|
|
- name: Backup the default pip_install_upper_constraints
|
|
set_fact:
|
|
__pip_install_upper_constraints: "{{ pip_install_upper_constraints }}"
|
|
when:
|
|
- __pip_install_upper_constraints is not defined
|
|
|
|
- name: Backup the default pip_default_index
|
|
set_fact:
|
|
__pip_default_index: "{{ pip_default_index }}"
|
|
when:
|
|
- __pip_default_index is not defined
|
|
|
|
- name: Test internal repo URL for the current get-pip.py script
|
|
uri:
|
|
url: "{{ __pip_upstream_url }}"
|
|
method: "HEAD"
|
|
timeout: 3
|
|
register: _repo_data_check
|
|
failed_when: false
|
|
tags:
|
|
- common-pip
|
|
|
|
- name: Test internal repo URL for the current upper constraints file
|
|
uri:
|
|
url: "{{ __pip_install_upper_constraints }}"
|
|
method: "HEAD"
|
|
timeout: 3
|
|
register: upper_constraints_check
|
|
failed_when: false
|
|
tags:
|
|
- common-constraints
|
|
|
|
- name: Test internal repo URL for the availability of the pypi index
|
|
uri:
|
|
url: "{{ __pip_default_index }}"
|
|
method: "HEAD"
|
|
timeout: 3
|
|
register: pip_default_index_check
|
|
failed_when: false
|
|
tags:
|
|
- common-constraints
|
|
|
|
- name: Remove global requirement pins file from host
|
|
file:
|
|
path: "/opt/global-requirement-pins.txt"
|
|
state: absent
|
|
when: (upper_constraints_check.status | default(503)) == 200
|
|
tags:
|
|
- common-constraints
|
|
|
|
- name: Copy global requirement pins file to host
|
|
copy:
|
|
src: "../global-requirement-pins.txt"
|
|
dest: "/opt/global-requirement-pins.txt"
|
|
when: (upper_constraints_check.status | default(503)) != 200
|
|
tags:
|
|
- common-constraints
|
|
|
|
# If we can't reach the internal repo, we need to ensure
|
|
# pip isn't locked to it.
|
|
- name: Set pip upstream URL
|
|
set_fact:
|
|
pip_upstream_url: >-
|
|
{{ ((_repo_data_check.status | default(503)) != 200) | ternary('https://bootstrap.pypa.io/3.3/get-pip.py', __pip_upstream_url) }}
|
|
tags:
|
|
- common-pip
|
|
|
|
- name: Set pip install upper constraints
|
|
set_fact:
|
|
pip_install_upper_constraints: >-
|
|
{{ ((upper_constraints_check.status | default(503)) != 200) | ternary(__upstream_constraints, __pip_install_upper_constraints) }}
|
|
vars:
|
|
# Use https when Python with native SNI support is available
|
|
__pip_install_upper_constraints_proto: "{{ ansible_python_version | version_compare('2.7.9', '>=') | ternary('https','http') }}"
|
|
__upstream_constraints: >-
|
|
/opt/global-requirement-pins.txt
|
|
--constraint {{ __pip_install_upper_constraints_proto }}://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?id={{ requirements_git_install_branch | regex_replace(' #.*$','') }}
|
|
|
|
tags:
|
|
- common-constraints
|
|
|
|
- name: Fallback to PyPI
|
|
set_fact:
|
|
pip_default_index: >-
|
|
{{ ((pip_default_index_check.status | default(503)) != 200) | ternary('https://pypi.python.org/simple', __pip_default_index) }}
|
|
tags:
|
|
- common-constraints
|