Merge "Reduce ansible bootstrap packages" into stable/ocata

This commit is contained in:
Jenkins 2017-07-19 01:33:44 +00:00 committed by Gerrit Code Review
commit 5adb70ff63
2 changed files with 29 additions and 35 deletions

View File

@ -30,9 +30,6 @@ export DEBIAN_FRONTEND=${DEBIAN_FRONTEND:-"noninteractive"}
# Set the role fetch mode to any option [galaxy, git-clone] # Set the role fetch mode to any option [galaxy, git-clone]
export ANSIBLE_ROLE_FETCH_MODE=${ANSIBLE_ROLE_FETCH_MODE:-galaxy} export ANSIBLE_ROLE_FETCH_MODE=${ANSIBLE_ROLE_FETCH_MODE:-galaxy}
# virtualenv vars
VIRTUALENV_OPTIONS="--always-copy"
# This script should be executed from the root directory of the cloned repo # This script should be executed from the root directory of the cloned repo
cd "$(dirname "${0}")/.." cd "$(dirname "${0}")/.."
@ -60,30 +57,22 @@ determine_distro
# Install the base packages # Install the base packages
case ${DISTRO_ID} in case ${DISTRO_ID} in
centos|rhel) centos|rhel)
yum -y install git python2 curl autoconf gcc-c++ \ yum -y install \
python2-devel gcc libffi-devel nc openssl-devel \ git curl autoconf gcc gcc-c++ nc \
python-pyasn1 pyOpenSSL python-ndg_httpsclient \ python2 python2-devel \
python-netaddr python-prettytable python-crypto PyYAML \ openssl-devel libffi-devel \
python-virtualenv libselinux-python
VIRTUALENV_OPTIONS=""
;; ;;
ubuntu) ubuntu)
apt-get update apt-get update
DEBIAN_FRONTEND=noninteractive apt-get -y install \ DEBIAN_FRONTEND=noninteractive apt-get -y install \
git python-all python-dev curl python2.7-dev build-essential \ git-core curl gcc netcat \
libssl-dev libffi-dev netcat python-requests python-openssl python-pyasn1 \ python2.7 python2.7-dev \
python-netaddr python-prettytable python-crypto python-yaml \ libssl-dev libffi-dev \
python-virtualenv python-apt
;; ;;
esac esac
# NOTE(mhayden): Ubuntu 16.04 needs python-ndg-httpsclient for SSL SNI support.
# This package is not needed in Ubuntu 14.04 and isn't available
# there as a package.
if [[ "${DISTRO_ID}" == 'ubuntu' ]] && [[ "${DISTRO_VERSION_ID}" == '16.04' ]]; then
DEBIAN_FRONTEND=noninteractive apt-get -y install python-ndg-httpsclient
fi
# Install pip # Install pip
get_pip get_pip
@ -105,8 +94,19 @@ UPPER_CONSTRAINTS_PROTO=$([ "$PYTHON_VERSION" == $(echo -e "$PYTHON_VERSION\n2.7
# Set the location of the constraints to use for all pip installations # Set the location of the constraints to use for all pip installations
export UPPER_CONSTRAINTS_FILE=${UPPER_CONSTRAINTS_FILE:-"$UPPER_CONSTRAINTS_PROTO://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?id=$(awk '/requirements_git_install_branch:/ {print $2}' playbooks/defaults/repo_packages/openstack_services.yml)"} export UPPER_CONSTRAINTS_FILE=${UPPER_CONSTRAINTS_FILE:-"$UPPER_CONSTRAINTS_PROTO://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?id=$(awk '/requirements_git_install_branch:/ {print $2}' playbooks/defaults/repo_packages/openstack_services.yml)"}
# Make sure that host requirements are installed
pip install ${PIP_OPTS} \
--requirement requirements.txt \
--constraint ${UPPER_CONSTRAINTS_FILE} \
|| pip install ${PIP_OPTS} \
--requirement requirements.txt \
--constraint ${UPPER_CONSTRAINTS_FILE} \
--isolated
# Create a Virtualenv for the Ansible runtime # Create a Virtualenv for the Ansible runtime
virtualenv --clear ${VIRTUALENV_OPTIONS} --python="${PYTHON_EXEC_PATH}" /opt/ansible-runtime virtualenv --python="${PYTHON_EXEC_PATH}" \
--clear \
/opt/ansible-runtime
# The vars used to prepare the Ansible runtime venv # The vars used to prepare the Ansible runtime venv
PIP_OPTS+=" --upgrade" PIP_OPTS+=" --upgrade"

View File

@ -241,24 +241,18 @@ function get_pip {
# when pip is not installed, install it # when pip is not installed, install it
else else
# Download the get-pip script using the primary or secondary URL
GETPIP_CMD="curl --silent --show-error --retry 5"
GETPIP_FILE="/opt/get-pip.py"
# If GET_PIP_URL is set, then just use it # If GET_PIP_URL is set, then just use it
if [ -n "${GET_PIP_URL:-}" ]; then if [ -n "${GET_PIP_URL:-}" ]; then
curl --silent ${GET_PIP_URL} > /opt/get-pip.py ${CURL_CMD} ${GET_PIP_URL} > ${OUTPUT_FILE}
if head -n 1 /opt/get-pip.py | grep python; then else
python /opt/get-pip.py ${PIP_INSTALL_OPTIONS} # Otherwise, try the two standard URL's
return ${CURL_CMD} https://bootstrap.pypa.io/get-pip.py > ${OUTPUT_FILE}\
fi || ${CURL_CMD} https://raw.githubusercontent.com/pypa/get-pip/master/get-pip.py > ${OUTPUT_FILE}
fi fi
# Try getting pip from bootstrap.pypa.io as a primary source
curl --silent https://bootstrap.pypa.io/get-pip.py > /opt/get-pip.py
if head -n 1 /opt/get-pip.py | grep python; then
python /opt/get-pip.py ${PIP_INSTALL_OPTIONS}
return
fi
# Try the get-pip.py from the github repository as a primary source
curl --silent https://raw.githubusercontent.com/pypa/get-pip/master/get-pip.py > /opt/get-pip.py
if head -n 1 /opt/get-pip.py | grep python; then if head -n 1 /opt/get-pip.py | grep python; then
python /opt/get-pip.py ${PIP_INSTALL_OPTIONS} python /opt/get-pip.py ${PIP_INSTALL_OPTIONS}
return return