blob: f3c0f9810da1981939a0e1e5c798958f6e1a7013 [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
8# - prettytable 0.7.2 permissions are 600 in the package and
9# pip 1.4 doesn't fix it (1.3 did)
10# - httplib2 0.8 permissions are 600 in the package and
11# pip 1.4 doesn't fix it (1.3 did)
Dean Troyer49ba2242013-08-09 19:51:20 -050012# - RHEL6:
13# - set selinux not enforcing
14# - (re)start messagebus daemon
15# - remove distro packages python-crypto and python-lxml
16# - pre-install hgtools to work around a bug in RHEL6 distribute
17# - install nose 1.1 from EPEL
18
Adam Spiersc85ade72013-10-01 00:35:16 +010019set -o errexit
20set -o xtrace
Dean Troyer9acc12a2013-08-09 15:09:31 -050021
22# Keep track of the current directory
23TOOLS_DIR=$(cd $(dirname "$0") && pwd)
Dean Troyer49ba2242013-08-09 19:51:20 -050024TOP_DIR=$(cd $TOOLS_DIR/..; pwd)
Dean Troyer9acc12a2013-08-09 15:09:31 -050025
26# Change dir to top of devstack
27cd $TOP_DIR
28
29# Import common functions
30source $TOP_DIR/functions
31
32FILES=$TOP_DIR/files
33
Dean Troyer49ba2242013-08-09 19:51:20 -050034
35# Python Packages
36# ---------------
37
Dean Troyer9acc12a2013-08-09 15:09:31 -050038# Pre-install affected packages so we can fix the permissions
Aaron Rosen1e4551d2013-09-16 13:58:08 -070039pip_install prettytable
40pip_install httplib2
Dean Troyer9acc12a2013-08-09 15:09:31 -050041
42SITE_DIRS=$(python -c "import site; import os; print os.linesep.join(site.getsitepackages())")
43for dir in $SITE_DIRS; do
44
45 # Fix prettytable 0.7.2 permissions
46 if [[ -r $dir/prettytable.py ]]; then
47 sudo chmod +r $dir/prettytable-0.7.2*/*
48 fi
49
50 # Fix httplib2 0.8 permissions
51 httplib_dir=httplib2-0.8.egg-info
52 if [[ -d $dir/$httplib_dir ]]; then
53 sudo chmod +r $dir/$httplib_dir/*
54 fi
55
56done
Dean Troyer49ba2242013-08-09 19:51:20 -050057
58
59# RHEL6
60# -----
61
62if [[ $DISTRO =~ (rhel6) ]]; then
63
64 # Disable selinux to avoid configuring to allow Apache access
65 # to Horizon files or run nodejs (LP#1175444)
66 # FIXME(dtroyer): see if this can be skipped without node or if Horizon is not enabled
67 if selinuxenabled; then
68 sudo setenforce 0
69 fi
70
71 # If the ``dbus`` package was installed by DevStack dependencies the
72 # uuid may not be generated because the service was never started (PR#598200),
73 # causing Nova to stop later on complaining that ``/var/lib/dbus/machine-id``
74 # does not exist.
75 sudo service messagebus restart
76
77 # The following workarounds break xenserver
78 if [ "$VIRT_DRIVER" != 'xenserver' ]; then
79 # An old version of ``python-crypto`` (2.0.1) may be installed on a
80 # fresh system via Anaconda and the dependency chain
81 # ``cas`` -> ``python-paramiko`` -> ``python-crypto``.
82 # ``pip uninstall pycrypto`` will remove the packaged ``.egg-info``
83 # file but leave most of the actual library files behind in
84 # ``/usr/lib64/python2.6/Crypto``. Later ``pip install pycrypto``
85 # will install over the packaged files resulting
86 # in a useless mess of old, rpm-packaged files and pip-installed files.
87 # Remove the package so that ``pip install python-crypto`` installs
88 # cleanly.
89 # Note: other RPM packages may require ``python-crypto`` as well.
90 # For example, RHEL6 does not install ``python-paramiko packages``.
91 uninstall_package python-crypto
92
93 # A similar situation occurs with ``python-lxml``, which is required by
94 # ``ipa-client``, an auditing package we don't care about. The
95 # build-dependencies needed for ``pip install lxml`` (``gcc``,
96 # ``libxml2-dev`` and ``libxslt-dev``) are present in
97 # ``files/rpms/general``.
98 uninstall_package python-lxml
99 fi
100
101 # ``setup.py`` contains a ``setup_requires`` package that is supposed
102 # to be transient. However, RHEL6 distribute has a bug where
103 # ``setup_requires`` registers entry points that are not cleaned
104 # out properly after the setup-phase resulting in installation failures
105 # (bz#924038). Pre-install the problem package so the ``setup_requires``
106 # dependency is satisfied and it will not be installed transiently.
107 # Note we do this before the track-depends in ``stack.sh``.
108 pip_install hgtools
109
110
111 # RHEL6's version of ``python-nose`` is incompatible with Tempest.
112 # Install nose 1.1 (Tempest-compatible) from EPEL
113 install_package python-nose1.1
114 # Add a symlink for the new nosetests to allow tox for Tempest to
115 # work unmolested.
116 sudo ln -sf /usr/bin/nosetests1.1 /usr/local/bin/nosetests
117
118fi