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