Merge "Reduce ansible bootstrap packages"

This commit is contained in:
Jenkins
2017-07-18 13:18:29 +00:00
committed by Gerrit Code Review
3 changed files with 29 additions and 37 deletions

View File

@@ -57,19 +57,19 @@ determine_distro
# Install the base packages
case ${DISTRO_ID} in
centos|rhel)
yum -y install git python2 curl autoconf gcc-c++ \
python2-devel gcc libffi-devel nc openssl-devel \
python-pyasn1 pyOpenSSL python-ndg_httpsclient \
python-netaddr python-prettytable python-crypto PyYAML \
python-virtualenv
yum -y install \
git curl autoconf gcc gcc-c++ nc \
python2 python2-devel \
openssl-devel libffi-devel \
libselinux-python
;;
ubuntu)
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get -y install \
git python3-all python3-dev curl python3.5-dev build-essential \
libssl-dev libffi-dev netcat python3-requests python3-openssl python3-pyasn1 \
python3-netaddr python3-prettytable python3-crypto python3-yaml \
python3-virtualenv python3-venv
git-core curl gcc netcat \
python3 python3-dev \
libssl-dev libffi-dev \
python3-apt
;;
esac
@@ -94,19 +94,14 @@ UPPER_CONSTRAINTS_PROTO=$([ "$PYTHON_VERSION" == $(echo -e "$PYTHON_VERSION\n2.7
# 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)"}
# Figure out the right virtualenv command and options
if [[ ${PYTHON_VERSION} =~ ^3 ]]; then
VIRTUALENV_COMMAND="python3 -m venv"
VIRTUALENV_OPTIONS="--copies"
else
VIRTUALENV_COMMAND="virtualenv --python=${PYTHON_EXEC_PATH}"
VIRTUALENV_OPTIONS="--always-copy"
fi
# Trying to use the copy option on CentOS fails miserably, so we override it.
if [[ "${DISTRO_ID}" == "centos" ]] || [[ "${DISTRO_ID}" == "rhel" ]]; then
VIRTUALENV_OPTIONS=""
fi
# 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
if [ -f "/opt/ansible-runtime/bin/python" ]; then
@@ -115,7 +110,9 @@ if [ -f "/opt/ansible-runtime/bin/python" ]; then
rm -rf /opt/ansible-runtime
fi
fi
${VIRTUALENV_COMMAND} --clear ${VIRTUALENV_OPTIONS} /opt/ansible-runtime
virtualenv --python=${PYTHON_EXEC_PATH} \
--clear \
/opt/ansible-runtime
# The vars used to prepare the Ansible runtime venv
PIP_OPTS+=" --upgrade"

View File

@@ -214,6 +214,7 @@ if [[ "${ACTION}" == "upgrade" ]]; then
# requirements to be installed.
unset ANSIBLE_PACKAGE
unset UPPER_CONSTRAINTS_FILE
unset VIRTUALENV_OPTIONS
# Kick off the data plane tester
bash ${OSA_CLONE_DIR}/tests/data-plane-test.sh &> /var/log/data-plane-error.log &

View File

@@ -210,24 +210,18 @@ function get_pip {
# when pip is not installed, install it
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 [ -n "${GET_PIP_URL:-}" ]; then
curl --silent ${GET_PIP_URL} > /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
${CURL_CMD} ${GET_PIP_URL} > ${OUTPUT_FILE}
else
# Otherwise, try the two standard URL's
${CURL_CMD} https://bootstrap.pypa.io/get-pip.py > ${OUTPUT_FILE}\
|| ${CURL_CMD} https://raw.githubusercontent.com/pypa/get-pip/master/get-pip.py > ${OUTPUT_FILE}
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
python /opt/get-pip.py ${PIP_INSTALL_OPTIONS}
return