Files
917ad0998be8c48bfcc0e3031bc1b75cd9ed1927
devstack /tools /fixup_stuff.sh

224 lines
8.8 KiB
Bash
Raw Normal View History

# **fixup_stuff.sh**
# fixup_stuff.sh
#
# All distro and package specific hacks go in here
# pip 1.4 doesn't fix it (1.3 did)
# pip 1.4 doesn't fix it (1.3 did)
# If ``TOP_DIR`` is set we're being sourced rather than running stand-alone
if [[ -z "$TOP_DIR" ]]; then
set -o errexit
set -o xtrace
TOOLS_DIR=$(cd $(dirname "0ドル") && pwd)
TOP_DIR=$(cd $TOOLS_DIR/..; pwd)
source $TOP_DIR/functions
fi
# -------------------------
# Reserve and prevent ``KEYSTONE_AUTH_PORT`` and ``KEYSTONE_AUTH_PORT_INT`` from
# 35358 which are in the Linux defined ephemeral port range (in disagreement
# with the IANA ephemeral port range). This is a workaround for bug #1253482
# 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}
# Only do the reserved ports when available, on some system (like containers)
# Get any currently reserved ports, strip off leading whitespace
reserved_ports=$(sysctl net.ipv4.ip_local_reserved_ports | awk -F'=' '{print 2ドル;}' | sed 's/^ //')
# If there are no currently reserved ports, reserve the keystone ports
sudo sysctl -w net.ipv4.ip_local_reserved_ports=${keystone_ports}
else
# If there are currently reserved ports, keep those and also reserve the
# Keystone specific ports. Duplicate reservations are merged into a single
sudo sysctl -w net.ipv4.ip_local_reserved_ports=${keystone_ports},${reserved_ports}
fi
#---------------------
# We've found that Libvirt on Xenial is flaky and crashes enough to be
# a regular top e-r bug. Opt into Ubuntu Cloud Archive if on Xenial to
# get newer Libvirt.
# libvirt 2.5.0 doesn't handle nested virtualization quite well and this
# is required for the trove development environment.
if [[ "${ENABLE_UBUNTU_CLOUD_ARCHIVE}" == "True" && "$DISTRO" = "xenial" ]]; then
install_package "software-properties-common"
# Use UCA for newer libvirt. Should give us libvirt 2.5.0.
if [[ -f /etc/ci/mirror_info.sh ]] ; then
# If we are on a nodepool provided host and it has told us about where
# we can find local mirrors then use that mirror.
source /etc/ci/mirror_info.sh
# Otherwise use upstream UCA
# Disable use of libvirt wheel since a cached wheel build might be
# against older libvirt binary. Particularly a problem if using
# the openstack wheel mirrors, but can hit locally too.
# TODO(clarkb) figure out how to use upstream wheel again.
iniset -sudo /etc/pip.conf "global" "no-binary" "libvirt-python"
REPOS_UPDATED=False
apt_get_update
# Python Packages
# ---------------
echo $(python -c "import os; import $package; print(os.path.split(os.path.realpath($package.__file__))[0])")
}
# These can go away once we are confident that pip 1.4.1+ is available everywhere
# Don't specify --upgrade so we use the existing package if present
# Only fix version 0.7.2
dir=$(echo $PACKAGE_DIR/prettytable-0.7.2*)
if [[ -d $dir ]]; then
sudo chmod +r $dir/*
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
sudo chmod +r $dir/*
fi
# Disable selinux to avoid configuring to allow Apache access
sudo setenforce 0
fi
# later fedoras). There was also an additional issue with
# firewalld hanging after install of libvirt with polkit [1].
# firewalld also causes problems with neturon+ipv6 [2]
#
# Note we do the same as the RDO packages and stop & disable,
# rather than remove. This is because other packages might
# have the dependency [3][4].
#
# [1] https://bugzilla.redhat.com/show_bug.cgi?id=1099031
# [2] https://bugs.launchpad.net/neutron/+bug/1455303
# [3] https://github.com/redhat-openstack/openstack-puppet-modules/blob/master/firewall/manifests/linux/redhat.pp
# at least on a baremetal Fedora 21 Server install.
install_package iptables-services
sudo systemctl stop firewalld
sudo systemctl start iptables
fi
# fedora these are symlinked back to the primary versions to
# avoid duplication of code on disk. This is fine when
# maintainers keep things in sync, but since devstack takes
# over and installs later versions via pip we can end up with
# incompatible versions.
#
# The rpm package is not removed to preserve the dependent
# packages like cloud-init; rather we remove the symlinks and
# force a re-install of requests so the vendored versions it
# wants are present.
#
# Realted issues:
# https://bugs.launchpad.net/glance/+bug/1476770
# https://bugzilla.redhat.com/show_bug.cgi?id=1253823
pip_install --upgrade --force-reinstall requests
fi
fi
# The version of pip(1.5.4) supported by python-virtualenv(1.11.4) has
# pip. To avoid having pip's virtualenv overwritten by the distro's
# package (e.g. due to installing a distro package with a dependency
# on python-virtualenv), first install the distro python-virtualenv
# to satisfy any dependencies then use pip to overwrite it.
# already done this to ensure the latest pip, virtualenv and
# setuptools on the base image for all platforms. It has also added
# the packages to the yum/dnf ignore list to prevent them being
# overwritten with old versions. F26 and dnf 2.0 has changed
# behaviour that means re-installing python-virtualenv fails [2].
# Thus we do a quick check if we're in the infra environment by
# looking for the mirror config script before doing this, and just
# skip it if so.
# [1] https://git.openstack.org/cgit/openstack/diskimage-builder/tree/ \
# diskimage_builder/elements/pip-and-virtualenv/ \
# 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
install_package python-virtualenv
pip_install -U --force-reinstall virtualenv
fi