Merge "Sync pip_install files"

This commit is contained in:
Zuul 2020-02-07 10:51:13 +00:00 committed by Gerrit Code Review
commit 74f8005978
2 changed files with 28 additions and 15 deletions

View File

@ -33,7 +33,6 @@
include: pip_install.yml
package=configparser
virtualenv=bifrost_venv_dir
extra_args="-c {{ upper_constraints_file }}"
when:
- skip_install is not defined
- enable_venv | bool == true
@ -42,7 +41,6 @@
include: pip_install.yml
package=pymysql
virtualenv=bifrost_venv_dir
extra_args="-c {{ upper_constraints_file }}"
when:
- skip_install is not defined
- enable_venv | bool == true
@ -51,7 +49,6 @@
include: pip_install.yml
package=python-openstackclient
virtualenv=bifrost_venv_dir
extra_args="-c {{ upper_constraints_file }}"
when:
- skip_install is not defined
- enable_venv | bool == true
@ -63,7 +60,7 @@
state=latest
sourcedir={{ keystone_git_folder }}
source_install={{ keystone_source_install | bool }}
extra_args="--no-cache-dir {{ pip_opts }} -c {{ upper_constraints_file }}"
extra_args="--no-cache-dir {{ pip_opts }}"
when:
- skip_install is not defined
- enable_venv | bool == true
@ -71,7 +68,6 @@
- name: "Install configparser if not using a venv"
include: pip_install.yml
package=configparser
extra_args="-c {{ upper_constraints_file }}"
when:
- skip_install is not defined
- enable_venv | bool == false
@ -79,7 +75,6 @@
- name: "Install pymysql if not using a venv"
include: pip_install.yml
package=pymysql
extra_args="-c {{ upper_constraints_file }}"
when:
- skip_install is not defined
- enable_venv | bool == false
@ -87,7 +82,6 @@
- name: "Install python-openstackclient if not using a venv"
include: pip_install.yml
package=python-openstackclient
extra_args="-c {{ upper_constraints_file }}"
when:
- skip_install is not defined
- enable_venv | bool == false
@ -98,7 +92,7 @@
state=latest
sourcedir={{ keystone_git_folder }}
source_install={{ keystone_source_install | bool }}
extra_args="--no-cache-dir {{ pip_opts }} -c {{ upper_constraints_file }}"
extra_args="--no-cache-dir {{ pip_opts }}"
when:
- skip_install is not defined
- enable_venv | bool == false

View File

@ -1,3 +1,5 @@
# Copyright (c) 2015 Hewlett Packard Enterprise Development LP.
#
# 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
@ -17,6 +19,15 @@
venv_command: "python3 -m venv"
when: enable_venv
- name: Set extra_args if upper_constraints_file is defined
set_fact:
constraints_extra_args: "{{ extra_args | default('') }} -c {{ upper_constraints_file }}"
when:
- (upper_constraints_file | default('')) != ''
# NOTE(dtantsur): constraining does not work correctly correctly with
# source installation if the package itself is in constraints.
- source_install is not defined or source_install == false
- name: "Install {{ package }} package from pip using virtualenv"
pip:
name: "{{ package }}"
@ -24,7 +35,7 @@
version: "{{ version | default(omit) }}"
virtualenv: "{{ bifrost_venv_dir }}"
virtualenv_command: "{{ venv_command | default(omit) }}"
extra_args: "{{ extra_args | default(omit) }}"
extra_args: "{{ constraints_extra_args | default(extra_args) | default(omit) }}"
requirements: "{{ requirements_file | default(omit) }}"
register: pip_package_install_done
until: pip_package_install_done is succeeded
@ -37,7 +48,7 @@
name: "{{ package }}"
state: "{{ state | default(omit) }}"
version: "{{ version | default(omit) }}"
extra_args: "{{ extra_args | default(omit) }}"
extra_args: "{{ constraints_extra_args | default(extra_args) | default(omit) }}"
requirements: "{{ requirements_file | default(omit) }}"
executable: /usr/bin/pip3
register: pip_package_install_done
@ -46,14 +57,22 @@
delay: 10
when: (source_install is not defined or source_install | bool == false ) and enable_venv | default(false) | bool == false
# NOTE (cinerama): We should be able to use the pip module here and
# possibly merge these two tasks when
# https://github.com/ansible/ansible-modules-core/pull/2600 lands.
- name: "Install from {{ sourcedir | default(package) }} using pip"
command: pip3 install {{ sourcedir | default(package) }} {{ extra_args | default('') }}
# NOTE (cinerama): We should be able to use the pip module here
- name: "Install requirements from {{ sourcedir }} using pip"
command: |
pip3 install -r {{ sourcedir }}/requirements.txt
{{ extra_args | default('') }}
{% if upper_constraints_file %}-c {{ upper_constraints_file }}{% endif %}
register: pip_package_install_done
until: pip_package_install_done is succeeded
retries: 5
delay: 10
when: source_install is defined and source_install | default(true) | bool
environment: "{{ bifrost_venv_env if enable_venv else {} }}"
# NOTE(dtantsur): do not use constraints here, it does not work when the
# package itself is constrained.
- name: "Install from {{ sourcedir }} using pip"
command: pip3 install {{ sourcedir }} {{ extra_args | default('') }}
when: source_install is defined and (source_install | bool == true)
environment: "{{ bifrost_venv_env if enable_venv else {} }}"