Break up fixup_stuff

Neutron functional tests want to use ubuntu cloud archive but it's
not possible to source the fixup_stuff.sh from a neutron CI setup
script. Break it up so that only the UCA portion can be executed
from neutron.

Change-Id: Ie18833bfa30f1789e63cbe9c86f5ece3453f43fb
This commit is contained in:
IWAMOTO Toshihiro 2018-02-05 16:57:41 +09:00
parent 22d70554ac
commit 4d835e33b6
2 changed files with 66 additions and 45 deletions

View File

@ -773,6 +773,7 @@ fi
# Do the ugly hacks for broken packages and distros
source $TOP_DIR/tools/fixup_stuff.sh
fixup_all
if [[ "$USE_SYSTEMD" == "True" ]]; then
pip_install_gr systemd-python

View File

@ -45,12 +45,13 @@ fi
# where Keystone will try and bind to the port and the port will already be
# in use as an ephemeral port by another process. This places an explicit
# exception into the Kernel for the Keystone AUTH ports.
keystone_ports=${KEYSTONE_AUTH_PORT:-35357},${KEYSTONE_AUTH_PORT_INT:-35358}
function fixup_keystone {
keystone_ports=${KEYSTONE_AUTH_PORT:-35357},${KEYSTONE_AUTH_PORT_INT:-35358}
# Only do the reserved ports when available, on some system (like containers)
# where it's not exposed we are almost pretty sure these ports would be
# exclusive for our DevStack.
if sysctl net.ipv4.ip_local_reserved_ports >/dev/null 2>&1; then
# Only do the reserved ports when available, on some system (like containers)
# where it's not exposed we are almost pretty sure these ports would be
# exclusive for our DevStack.
if sysctl net.ipv4.ip_local_reserved_ports >/dev/null 2>&1; then
# Get any currently reserved ports, strip off leading whitespace
reserved_ports=$(sysctl net.ipv4.ip_local_reserved_ports | awk -F'=' '{print $2;}' | sed 's/^ //')
@ -63,9 +64,10 @@ if sysctl net.ipv4.ip_local_reserved_ports >/dev/null 2>&1; then
# reservation (or range) automatically by the kernel.
sudo sysctl -w net.ipv4.ip_local_reserved_ports=${keystone_ports},${reserved_ports}
fi
else
else
echo_summary "WARNING: unable to reserve keystone ports"
fi
fi
}
# Ubuntu Cloud Archive
#---------------------
@ -79,8 +81,12 @@ fi
# ENABLE_VOLUME_MULTIATTACH is True, we can't use the Pike UCA
# because multiattach won't work with those package versions.
# We can remove this check when the UCA has libvirt>=3.10.
if [[ "${ENABLE_UBUNTU_CLOUD_ARCHIVE}" == "True" && "$DISTRO" = "xenial" && \
"${ENABLE_VOLUME_MULTIATTACH}" == "False" ]]; then
function fixup_uca {
if [[ "${ENABLE_UBUNTU_CLOUD_ARCHIVE}" == "False" || "$DISTRO" != "xenial" || \
"${ENABLE_VOLUME_MULTIATTACH}" == "True" ]]; then
return
fi
# This pulls in apt-add-repository
install_package "software-properties-common"
# Use UCA for newer libvirt. Should give us libvirt 2.5.0.
@ -104,8 +110,7 @@ if [[ "${ENABLE_UBUNTU_CLOUD_ARCHIVE}" == "True" && "$DISTRO" = "xenial" && \
# Force update our APT repos, since we added UCA above.
REPOS_UPDATED=False
apt_get_update
fi
}
# Python Packages
# ---------------
@ -120,27 +125,32 @@ function get_package_path {
# Pre-install affected packages so we can fix the permissions
# These can go away once we are confident that pip 1.4.1+ is available everywhere
# Fix prettytable 0.7.2 permissions
# Don't specify --upgrade so we use the existing package if present
pip_install 'prettytable>=0.7'
PACKAGE_DIR=$(get_package_path prettytable)
# Only fix version 0.7.2
dir=$(echo $PACKAGE_DIR/prettytable-0.7.2*)
if [[ -d $dir ]]; then
function fixup_python_packages {
# Fix prettytable 0.7.2 permissions
# Don't specify --upgrade so we use the existing package if present
pip_install 'prettytable>=0.7'
PACKAGE_DIR=$(get_package_path prettytable)
# Only fix version 0.7.2
dir=$(echo $PACKAGE_DIR/prettytable-0.7.2*)
if [[ -d $dir ]]; then
sudo chmod +r $dir/*
fi
fi
# Fix httplib2 0.8 permissions
# Don't specify --upgrade so we use the existing package if present
pip_install httplib2
PACKAGE_DIR=$(get_package_path httplib2)
# Only fix version 0.8
dir=$(echo $PACKAGE_DIR-0.8*)
if [[ -d $dir ]]; then
# Fix httplib2 0.8 permissions
# Don't specify --upgrade so we use the existing package if present
pip_install httplib2
PACKAGE_DIR=$(get_package_path httplib2)
# Only fix version 0.8
dir=$(echo $PACKAGE_DIR-0.8*)
if [[ -d $dir ]]; then
sudo chmod +r $dir/*
fi
fi
}
if is_fedora; then
function fixup_fedora {
if ! is_fedora; then
return
fi
# Disable selinux to avoid configuring to allow Apache access
# to Horizon files (LP#1175444)
if selinuxenabled; then
@ -198,7 +208,7 @@ if is_fedora; then
pip_install --upgrade --force-reinstall requests
fi
fi
fi
}
# The version of pip(1.5.4) supported by python-virtualenv(1.11.4) has
# connection issues under proxy so re-install the latest version using
@ -222,7 +232,17 @@ fi
# install.d/pip-and-virtualenv-source-install/04-install-pip
# [2] https://bugzilla.redhat.com/show_bug.cgi?id=1477823
if [[ ! -f /etc/ci/mirror_info.sh ]]; then
function fixup_virtualenv {
if [[ ! -f /etc/ci/mirror_info.sh ]]; then
install_package python-virtualenv
pip_install -U --force-reinstall virtualenv
fi
fi
}
function fixup_all {
fixup_keystone
fixup_uca
fixup_python_packages
fixup_fedora
fixup_virtualenv
}