blob: 9e65b7c21e7a0353ba3b369c87f0390954a317ec [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 Troyer65f1af62013-10-16 12:10:13 -050038# get_package_path python-package # in import notation
39function get_package_path() {
40 local package=$1
41 echo $(python -c "import os; import $package; print(os.path.split(os.path.realpath($package.__file__))[0])")
42}
43
44
Dean Troyer9acc12a2013-08-09 15:09:31 -050045# Pre-install affected packages so we can fix the permissions
Dean Troyer65f1af62013-10-16 12:10:13 -050046# These can go away once we are confident that pip 1.4.1+ is available everywhere
47
48# Fix prettytable 0.7.2 permissions
49# Don't specify --upgrade so we use the existing package if present
Aaron Rosen1e4551d2013-09-16 13:58:08 -070050pip_install prettytable
Dean Troyer65f1af62013-10-16 12:10:13 -050051PACKAGE_DIR=$(get_package_path prettytable)
52# Only fix version 0.7.2
53dir=$(echo $PACKAGE_DIR/prettytable-0.7.2*)
54if [[ -d $dir ]]; then
55 sudo chmod +r $dir/*
56fi
57
58# Fix httplib2 0.8 permissions
59# Don't specify --upgrade so we use the existing package if present
Aaron Rosen1e4551d2013-09-16 13:58:08 -070060pip_install httplib2
Dean Troyer65f1af62013-10-16 12:10:13 -050061PACKAGE_DIR=$(get_package_path httplib2)
62# Only fix version 0.8
63dir=$(echo $PACKAGE_DIR-0.8*)
64if [[ -d $dir ]]; then
65 sudo chmod +r $dir/*
66fi
Dean Troyer49ba2242013-08-09 19:51:20 -050067
68
69# RHEL6
70# -----
71
72if [[ $DISTRO =~ (rhel6) ]]; then
73
74 # Disable selinux to avoid configuring to allow Apache access
75 # to Horizon files or run nodejs (LP#1175444)
76 # FIXME(dtroyer): see if this can be skipped without node or if Horizon is not enabled
77 if selinuxenabled; then
78 sudo setenforce 0
79 fi
80
81 # If the ``dbus`` package was installed by DevStack dependencies the
82 # uuid may not be generated because the service was never started (PR#598200),
83 # causing Nova to stop later on complaining that ``/var/lib/dbus/machine-id``
84 # does not exist.
85 sudo service messagebus restart
86
87 # The following workarounds break xenserver
88 if [ "$VIRT_DRIVER" != 'xenserver' ]; then
89 # An old version of ``python-crypto`` (2.0.1) may be installed on a
90 # fresh system via Anaconda and the dependency chain
91 # ``cas`` -> ``python-paramiko`` -> ``python-crypto``.
92 # ``pip uninstall pycrypto`` will remove the packaged ``.egg-info``
93 # file but leave most of the actual library files behind in
94 # ``/usr/lib64/python2.6/Crypto``. Later ``pip install pycrypto``
95 # will install over the packaged files resulting
96 # in a useless mess of old, rpm-packaged files and pip-installed files.
97 # Remove the package so that ``pip install python-crypto`` installs
98 # cleanly.
99 # Note: other RPM packages may require ``python-crypto`` as well.
100 # For example, RHEL6 does not install ``python-paramiko packages``.
101 uninstall_package python-crypto
102
103 # A similar situation occurs with ``python-lxml``, which is required by
104 # ``ipa-client``, an auditing package we don't care about. The
105 # build-dependencies needed for ``pip install lxml`` (``gcc``,
106 # ``libxml2-dev`` and ``libxslt-dev``) are present in
107 # ``files/rpms/general``.
108 uninstall_package python-lxml
109 fi
110
111 # ``setup.py`` contains a ``setup_requires`` package that is supposed
112 # to be transient. However, RHEL6 distribute has a bug where
113 # ``setup_requires`` registers entry points that are not cleaned
114 # out properly after the setup-phase resulting in installation failures
115 # (bz#924038). Pre-install the problem package so the ``setup_requires``
116 # dependency is satisfied and it will not be installed transiently.
117 # Note we do this before the track-depends in ``stack.sh``.
118 pip_install hgtools
119
120
121 # RHEL6's version of ``python-nose`` is incompatible with Tempest.
122 # Install nose 1.1 (Tempest-compatible) from EPEL
123 install_package python-nose1.1
124 # Add a symlink for the new nosetests to allow tox for Tempest to
125 # work unmolested.
126 sudo ln -sf /usr/bin/nosetests1.1 /usr/local/bin/nosetests
127
128fi