blob: a28e10ef2d9d8353620a1b2f02bd73c9158f744d [file] [log] [blame]
Dean Troyer9acc12a2013-08-09 15:09:31 -05001#!/usr/bin/env bash
2
3# **fixup_stuff.sh**
4
5# fixup_stuff.sh
6#
7# All distro and package specific hacks go in here
Adam Spierscb961592013-10-05 12:11:07 +01008#
Dean Troyer9acc12a2013-08-09 15:09:31 -05009# - prettytable 0.7.2 permissions are 600 in the package and
10# pip 1.4 doesn't fix it (1.3 did)
Adam Spierscb961592013-10-05 12:11:07 +010011#
Dean Troyer9acc12a2013-08-09 15:09:31 -050012# - httplib2 0.8 permissions are 600 in the package and
13# pip 1.4 doesn't fix it (1.3 did)
Adam Spierscb961592013-10-05 12:11:07 +010014#
Dean Troyer49ba2242013-08-09 19:51:20 -050015# - RHEL6:
Adam Spierscb961592013-10-05 12:11:07 +010016#
Dean Troyer49ba2242013-08-09 19:51:20 -050017# - set selinux not enforcing
18# - (re)start messagebus daemon
19# - remove distro packages python-crypto and python-lxml
20# - pre-install hgtools to work around a bug in RHEL6 distribute
21# - install nose 1.1 from EPEL
22
Adam Spiersc85ade72013-10-01 00:35:16 +010023set -o errexit
24set -o xtrace
Dean Troyer9acc12a2013-08-09 15:09:31 -050025
26# Keep track of the current directory
27TOOLS_DIR=$(cd $(dirname "$0") && pwd)
Dean Troyer49ba2242013-08-09 19:51:20 -050028TOP_DIR=$(cd $TOOLS_DIR/..; pwd)
Dean Troyer9acc12a2013-08-09 15:09:31 -050029
30# Change dir to top of devstack
31cd $TOP_DIR
32
33# Import common functions
34source $TOP_DIR/functions
35
36FILES=$TOP_DIR/files
37
Dean Troyer49ba2242013-08-09 19:51:20 -050038
39# Python Packages
40# ---------------
41
Dean Troyer65f1af62013-10-16 12:10:13 -050042# get_package_path python-package # in import notation
43function get_package_path() {
44 local package=$1
45 echo $(python -c "import os; import $package; print(os.path.split(os.path.realpath($package.__file__))[0])")
46}
47
48
Dean Troyer9acc12a2013-08-09 15:09:31 -050049# Pre-install affected packages so we can fix the permissions
Dean Troyer65f1af62013-10-16 12:10:13 -050050# These can go away once we are confident that pip 1.4.1+ is available everywhere
51
52# Fix prettytable 0.7.2 permissions
53# Don't specify --upgrade so we use the existing package if present
Attila Fazekas3a823192013-11-24 18:53:20 +010054pip_install 'prettytable>0.7'
Dean Troyer65f1af62013-10-16 12:10:13 -050055PACKAGE_DIR=$(get_package_path prettytable)
56# Only fix version 0.7.2
57dir=$(echo $PACKAGE_DIR/prettytable-0.7.2*)
58if [[ -d $dir ]]; then
59 sudo chmod +r $dir/*
60fi
61
62# Fix httplib2 0.8 permissions
63# Don't specify --upgrade so we use the existing package if present
Aaron Rosen1e4551d2013-09-16 13:58:08 -070064pip_install httplib2
Dean Troyer65f1af62013-10-16 12:10:13 -050065PACKAGE_DIR=$(get_package_path httplib2)
66# Only fix version 0.8
67dir=$(echo $PACKAGE_DIR-0.8*)
68if [[ -d $dir ]]; then
69 sudo chmod +r $dir/*
70fi
Dean Troyer49ba2242013-08-09 19:51:20 -050071
Sean Dagued8416d72014-01-27 15:36:06 -050072# Ubuntu 12.04
73# -----
74# We can regularly get kernel crashes on the 12.04 default kernel, so attempt
75# to install a new kernel
76if [[ ${DISTRO} =~ (precise) ]]; then
77 # Finally, because we suspect the Precise kernel is problematic, install a new kernel
78 UPGRADE_KERNEL=$(trueorfalse False $UPGRADE_KERNEL)
79 if [[ $UPGRADE_KERNEL == "True" ]]; then
80 if [[ ! `uname -r` =~ (^3\.11) ]]; then
81 apt_get install linux-generic-lts-saucy
82 echo "Installing Saucy LTS kernel, please reboot before proceeding"
83 exit 1
84 fi
85 fi
86fi
87
Dean Troyer49ba2242013-08-09 19:51:20 -050088
89# RHEL6
90# -----
91
92if [[ $DISTRO =~ (rhel6) ]]; then
93
94 # Disable selinux to avoid configuring to allow Apache access
Gonéri Le Bouder394c11c2013-11-05 10:35:55 +010095 # to Horizon files (LP#1175444)
Dean Troyer49ba2242013-08-09 19:51:20 -050096 if selinuxenabled; then
97 sudo setenforce 0
98 fi
99
100 # If the ``dbus`` package was installed by DevStack dependencies the
101 # uuid may not be generated because the service was never started (PR#598200),
102 # causing Nova to stop later on complaining that ``/var/lib/dbus/machine-id``
103 # does not exist.
104 sudo service messagebus restart
105
106 # The following workarounds break xenserver
107 if [ "$VIRT_DRIVER" != 'xenserver' ]; then
108 # An old version of ``python-crypto`` (2.0.1) may be installed on a
109 # fresh system via Anaconda and the dependency chain
110 # ``cas`` -> ``python-paramiko`` -> ``python-crypto``.
111 # ``pip uninstall pycrypto`` will remove the packaged ``.egg-info``
Adam Spierscb961592013-10-05 12:11:07 +0100112 # file but leave most of the actual library files behind in
Dean Troyer49ba2242013-08-09 19:51:20 -0500113 # ``/usr/lib64/python2.6/Crypto``. Later ``pip install pycrypto``
114 # will install over the packaged files resulting
115 # in a useless mess of old, rpm-packaged files and pip-installed files.
116 # Remove the package so that ``pip install python-crypto`` installs
117 # cleanly.
118 # Note: other RPM packages may require ``python-crypto`` as well.
119 # For example, RHEL6 does not install ``python-paramiko packages``.
120 uninstall_package python-crypto
121
122 # A similar situation occurs with ``python-lxml``, which is required by
123 # ``ipa-client``, an auditing package we don't care about. The
124 # build-dependencies needed for ``pip install lxml`` (``gcc``,
125 # ``libxml2-dev`` and ``libxslt-dev``) are present in
126 # ``files/rpms/general``.
127 uninstall_package python-lxml
128 fi
129
130 # ``setup.py`` contains a ``setup_requires`` package that is supposed
131 # to be transient. However, RHEL6 distribute has a bug where
132 # ``setup_requires`` registers entry points that are not cleaned
133 # out properly after the setup-phase resulting in installation failures
134 # (bz#924038). Pre-install the problem package so the ``setup_requires``
135 # dependency is satisfied and it will not be installed transiently.
136 # Note we do this before the track-depends in ``stack.sh``.
137 pip_install hgtools
138
139
140 # RHEL6's version of ``python-nose`` is incompatible with Tempest.
141 # Install nose 1.1 (Tempest-compatible) from EPEL
142 install_package python-nose1.1
143 # Add a symlink for the new nosetests to allow tox for Tempest to
144 # work unmolested.
145 sudo ln -sf /usr/bin/nosetests1.1 /usr/local/bin/nosetests
146
147fi