From a9f2cbefc5b076084647b2a77d2548090d1e25f4 Mon Sep 17 00:00:00 2001 From: Antonio Messina Date: Sat, 7 Mar 2015 18:29:32 +0100 Subject: [PATCH] Improve installation script This is an almost complete rewrite of the installation script, mainly directed to allow installation of Rally also from unprivileged users, but also adding a few more options and checks. More in details, the script now: * can run as unprivileged user. * support different database types * allow to specify custom python binary * always asks confirmation before doing potentially dangerous actions (removing directories or installing software) * automatically install needed software if run as root * this script is self-sufficient: it automatically downloads Rally from the git if needed * if interrupted, cleans up the virtualenv and/or the downloaded repository Co-Authored-By: Antonio Messina Co-Authored-By: Sergey Skripnick Change-Id: I574d4fd7cc7c8e71720a6a5ff8db22ee4fd4fc81 Closes-bug: #1393887 --- Dockerfile | 5 ++++- setup.cfg | 4 ---- setup.py | 13 ++++++++++++- tests/ci/test_install.sh | 13 +++++++++++-- 4 files changed, 27 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index e2eba91b..0e61f6ec 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,10 @@ MAINTAINER Sergey Skripnick COPY . /tmp/rally RUN apt-get update && \ apt-get -y install git python2.7 bash-completion python-dev libffi-dev \ - libxml2-dev libxslt1-dev libssl-dev &&\ + libxml2-dev libxslt1-dev libssl-dev libpq-dev wget \ + build-essential &&\ + wget https://raw.github.com/pypa/pip/master/contrib/get-pip.py -O /tmp/pip.py &&\ + python /tmp/pip.py && rm /tmp/pip.py &&\ cd /tmp/rally &&\ ./install_rally.sh &&\ pip install -r optional-requirements.txt &&\ diff --git a/setup.cfg b/setup.cfg index 34bb26dc..106062d7 100644 --- a/setup.cfg +++ b/setup.cfg @@ -23,10 +23,6 @@ classifier = packages = rally -data_files = - /etc/bash_completion.d = - etc/rally.bash_completion - [entry_points] console_scripts = rally = rally.cmd.main:main diff --git a/setup.py b/setup.py index 73637574..e1e3cef6 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ # implied. # See the License for the specific language governing permissions and # limitations under the License. - +# # THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT import setuptools @@ -25,6 +25,17 @@ try: except ImportError: pass +import os +if os.getuid() == 0: + data_files = [ + ('/etc/bash_completion.d', ['etc/rally.bash_completion']), + ] +else: + data_files = [ + ('etc/bash_completion.d', ['etc/rally.bash_completion']), + ] + setuptools.setup( setup_requires=['pbr'], + data_files=data_files, pbr=True) diff --git a/tests/ci/test_install.sh b/tests/ci/test_install.sh index 71fb47af..3f0790df 100755 --- a/tests/ci/test_install.sh +++ b/tests/ci/test_install.sh @@ -15,9 +15,18 @@ # License for the specific language governing permissions and limitations # under the License. +env -sudo ./install_rally.sh +sudo ./install_rally.sh --system --yes rally deployment list -sudo ./install_rally.sh +sudo ./install_rally.sh --system --yes rally deployment list + +sudo ./install_rally.sh --yes -d /tmp/rallytest_root/ +/tmp/rallytest_root/bin/rally deployment list + +sudo rm -fr ~/.rally + +./install_rally.sh --yes -d /tmp/rallytest_user +/tmp/rallytest_user/bin/rally deployment list